ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find Last Row Hidden (https://www.excelbanter.com/excel-programming/288582-find-last-row-hidden.html)

John Wilson

Find Last Row Hidden
 
Just came across this today.....

Maybe someone can explain ???

I was always under the impression that
Range("A" & Rows.Count).End(xlUp).Row
would give the last row with a value in the chosen column.

If I have data in rows 1 thru 10, the above returns 10.
If I hide rows 9 & 10, it returns 8??

I would have thought that I'd have to specify Visible Cells
to get a result like that.

Thanks,
John



BrianB

Find Last Row Hidden
 
It looks to me (in my ignorance) as if Excel is doing exactly as
requested.

Try this one on your sheet with rows hidden. Once again Excel wins. :-
'---------------------------------------------------------------------
Set foundcell = ActiveSheet.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, SearchOrder:=xlByRows)
MsgBox (foundcell.Row)
'-----------------------------------------------------------------------

It's the way we ask. This is definitely one (two) for the archives.
Thanks for the observation !


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 11:17 AM.

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