![]() |
Range to Last Cell
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. |
Range to Last Cell
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. "Grey Old Man" wrote: 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. |
All times are GMT +1. The time now is 06:54 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com