Macro Question

R

richard birkett

I am familiar with the Macro tool. Where I fall down is when I attempt to
have it go to a cell that changes from sheet to sheet. As an example, I want
it to highlight all of the cells on a sheet with data and format the font
size and color. The first two rows are always in bold, but everything else
is not. Each month the data changes so the list varies, thus the problem. My
recorder picks up the first and last cell I went to the last time I used it,
so I need it to seek the last cell with data (whatever that may be each
month) without having to rewrite the macro. Any ideas for a "one-size fits
all" macro?

Rich
 
B

Bernie Deitrick

Rich,

Select a cell within your data table, and run a macro like the one below. Of
course, you'll need to change the font, size, and color index to match what
you actually want.

HTH,
Bernie
MS Excel MVP

Sub FormatTable()
Dim myRange As Range

Set myRange = ActiveCell.CurrentRegion
With myRange
With .Font
.Name = "Comic Sans MS"
.Size = 14
.ColorIndex = 3
End With
With .Resize(2, .Columns.Count)
.Font.Bold = True
End With
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top