ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find last row code (https://www.excelbanter.com/excel-discussion-misc-queries/145280-find-last-row-code.html)

Mike Milmoe

Find last row code
 
I have the following code to find the last row with data. It works
perfectly. However, how can I make it work on any sheet, essentially the
active tab, as opposed to a specific sheet as in the below example.

Sheets("HI01").Cells(Last(1, ActiveSheet.Cells), "m").Select

Dave O[_2_]

Find last row code
 
Try this:
Sheets(activesheet.name).Cells(Last(1, ActiveSheet.Cells),
"m").Select



Mike Milmoe

Find last row code
 
Thanks Dave. This worked great. Sorry about the multiple postings.
Couldn't see my question.

"Dave O" wrote:

Try this:
Sheets(activesheet.name).Cells(Last(1, ActiveSheet.Cells),
"m").Select





All times are GMT +1. The time now is 02:21 PM.

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