Range to Last Cell

  • Thread starter Thread starter Grey Old Man
  • Start date Start date
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.
 
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.
 
Back
Top