For Each with Hidden Rows

  • Thread starter Thread starter Tod
  • Start date Start date
T

Tod

My worksheet has hidden rows. Which rows are hidden is
not known at run time. I want to do a For Each... loop
that cycles through a range of cells in a column. However
I've noticed that the loop ignores cells in hidden rows.
Is there a way to cycle through a range that includes
hidden rows?

tod
 
Oops. It wasn't that the loop was skipping hidden rows.
It was that my statement for finding the last row was
flawed.

So as Emily Litella would say....

Never Mind
 
I can't duplicate your problem. If I hide 4 rows between 1 and 15, then run
the following code, 1 see all 15 row numbers. Ditto if the rows are hidden via
AutoFilter. Can you post your code?

for i = 1 to 15: debug.Print rows(i).row: next i
for each r in range("A1:A15").rows: debug.Print r.row: next r
 
Back
Top