A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Goto last row of the sheet



 
 
Thread Tools Display Modes
  #1  
Old April 10th, 2009, 09:46 AM posted to microsoft.public.excel.worksheet.functions
Elton Law[_2_]
external usenet poster
 
Posts: 94
Default Goto last row of the sheet

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...
  #2  
Old April 10th, 2009, 10:36 AM posted to microsoft.public.excel.worksheet.functions
Mike H
external usenet poster
 
Posts: 8,419
Default Goto last row of the sheet

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

"Elton Law" wrote:

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

  #3  
Old April 10th, 2009, 10:41 AM posted to microsoft.public.excel.worksheet.functions
Gary''s Student
external usenet poster
 
Posts: 7,584
Default Goto last row of the sheet

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

--
Gary''s Student - gsnu200845


"Elton Law" wrote:

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

  #4  
Old April 10th, 2009, 02:55 PM posted to microsoft.public.excel.worksheet.functions
Don Guillett
external usenet poster
 
Posts: 6,167
Default Goto last row of the sheet

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Elton Law" wrote in message
...
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...


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:07 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.