Find last row with hidden rows

S

Sherry

I am using the following code to find the last row of a worksheet. It works
fine as long as the last used row is unhidden. But it I hide it, then this
does not work as I want. I need to find the absolute last row whether it is
hidden or unhidden.

Can anyone help?

FindLastRow = objSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
 
M

Mike H

Try

lastrow = Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Row

Mike
 
S

Sherry

Works GREAT! Thank you.

Mike H said:
Try

lastrow = Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Row

Mike

Sherry said:
I am using the following code to find the last row of a worksheet. It works
fine as long as the last used row is unhidden. But it I hide it, then this
does not work as I want. I need to find the absolute last row whether it is
hidden or unhidden.

Can anyone help?

FindLastRow = objSheet.Cells.SpecialCells(xlCellTypeLastCell).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