Goto last row of the sheet

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...
 
M

Mike H

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
 
G

Gary''s Student

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
 
D

Don Guillett

lr = Cells.Find("*", Cells(Rows.Count, Columns.Count) _
, , , xlByRows, xlPrevious).Row
 

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