ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find last row with hidden rows (https://www.excelbanter.com/excel-discussion-misc-queries/206118-find-last-row-hidden-rows.html)

Sherry

Find last row with hidden rows
 
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).Ro w

Mike H

Find last row with hidden rows
 
Try

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

Mike

"Sherry" wrote:

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).Ro w


Sherry

Find last row with hidden rows
 
Works GREAT! Thank you.

"Mike H" wrote:

Try

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

Mike

"Sherry" wrote:

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).Ro w



All times are GMT +1. The time now is 08:22 PM.

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