Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 173
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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
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...

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Goto Tab Ed Davis Excel Discussion (Misc queries) 3 September 4th 08 10:35 PM
Goto or Find a Date in a Sheet Kev - Radio Man Excel Discussion (Misc queries) 1 March 28th 08 09:40 AM
Gosub - Goto ? El Bee Excel Worksheet Functions 5 February 13th 07 08:51 PM
Goto code Bob Excel Discussion (Misc queries) 4 July 6th 06 05:44 PM
If.....Then GoTo....... Alec H Excel Discussion (Misc queries) 4 February 22nd 06 02:42 PM


All times are GMT +1. The time now is 04:17 PM.

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

About Us

"It's about Microsoft Excel"