ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   find last row in a sheet (https://www.excelbanter.com/excel-discussion-misc-queries/165056-find-last-row-sheet.html)

Janis

find last row in a sheet
 
EndRow = Cells(Rows.Count, 1).End(xlUp)

I need the last used row count. This statement seems to count the last row
but not the used range. How do I find the last used row?


thanks,

carlo

find last row in a sheet
 
On Nov 7, 11:13 am, Janis wrote:
EndRow = Cells(Rows.Count, 1).End(xlUp)

I need the last used row count. This statement seems to count the last row
but not the used range. How do I find the last used row?

thanks,


EndRow = Cells(65536,1).End(xlup).row

hth

Carlo


David McRitchie

find last row in a sheet
 
"carlo" wrote in message ups.com...
On Nov 7, 11:13 am, Janis wrote:
EndRow = Cells(Rows.Count, 1).End(xlUp)

I need the last used row count. This statement seems to count the last row
but not the used range. How do I find the last used row?

thanks,


EndRow = Cells(65536,1).End(xlup).row


The same but one that would work in all versions of Excel

Sub GotoBottomOfCurrentColumn()
'based on a posting by Tom Ogilvy 2000-06-26
Cells(Rows.Count, ActiveCell.Column).End(xlUp).Select
End Sub

Additional similar macros and toolbar buttons to go with them in
http://www.mvps.org/dmcritchie/excel/toolbars.htm


--
HTH,
David McRitchie, Microsoft MVP -- Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm



David McRitchie

find last row in a sheet
 
...
"carlo" wrote in message ups.com...
On Nov 7, 11:13 am, Janis wrote:
EndRow = Cells(Rows.Count, 1).End(xlUp)

I need the last used row count. This statement seems to count the last row
but not the used range. How do I find the last used row?

thanks,


EndRow = Cells(65536,1).End(xlup).row


Sorry didn't read the question properly, ignore my previous answer
modify Carlo's to read -- based on column 1 (Column A), it is
not based on what Excel considers to be the last cell.

EndRow = Cells(Rows.Count,1).End(xlup).row

You can read about lastcell at
http://www.mvps.org/dmcritchie/excel/lastcell.htm
--
HTH,
David McRitchie, Microsoft MVP -- Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm




All times are GMT +1. The time now is 12:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com