MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Deleting Hidden Rows. Beginner needs help

Posted by Victor Sheahan on January 12, 2001 9:22 AM

Apologies for my ignorance but could someone tell me the code for a macro that will delete all the hidden rows in a worksheet.

Thanks for the help

Posted by Robert Faass on January 12, 2001 10:20 AM

Use this example, I count only the not hidden rows... I assume you know how to delete...

For i = LBound(week_data) To UBound(week_data)
If Not wkdata(i).EntireRow.Hidden Then ' only compute the visible ones
cell = week_data(i, 1)
If (InStr(1, cell, "x", 1) > 0 Or InStr(1, cell, "f", 1) > 0) _
And (p_type(i, 1) = "s") Then
count = count + 1
End If
End If
Next i