Goto last row of the sheet

  • Thread starter Thread starter Elton Law
  • Start date Start date
E

Elton Law

Hi Expert,
My excel spreadsheet is different days by days.
Sometimes, it has 6552 rows. Sometime, it has 7744 rows .... etc ... etc ....
Except Control + End + Down .... (VB does not help sometimes, that depend on
whether each row is continuous without a break), what is the script in VB
that can help me going to last row of the spreadsheet please ?
Thanks in advance...
 
Hi,

The last used row can be found with

lastrow = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows,
SearchDirection:=xlPrevious).Row

to select column A of that row use

Range("A" & Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows,
SearchDirection:=xlPrevious).Row).Select


Mike
 
Sub range_reporter()
Dim r As Range
Dim nLastRow As Long
Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.Count + r.Row - 1
Cells(nLastRow, 1).Select
End Sub
 
lr = Cells.Find("*", Cells(Rows.Count, Columns.Count) _
, , , xlByRows, xlPrevious).Row
 
Back
Top