Range to Last Cell

G

Grey Old Man

I am writing an Excel 2002 template and wish to use VBA to 'highlight' a
range from A3 to the last cell. The row of the last cell will vary but will
always be in column N.

My VBA knowledge is limited. I have tried and failed with
Range ("A3").SpecialCells(xlLastCell).Activate
and I am not sure if I need 'Select' or 'Activate' to 'highlight' the range.

When complete, the worksheet view should show A1 as the top left (home) cell
rather than (for example) N999 at the bottom right.

Thanks in anticipation.
 
M

Mike H

Hi,

With the usual caveat that it is extremely unlikely you need to select this
range to do what you want to do

Dim LastRow As Long
Set sht = Sheets("Sheet1")
LastRow = sht.Cells(Cells.Rows.Count, "N").End(xlUp).Row
sht.Range("A3:N" & LastRow).Select
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 

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