Macro to unhide the top row of many hidden rows


Posted by Chris Rock on June 27, 2001 1:20 PM

I am learning VBA now (slowly but surely), but posting questions on this board is a lot faster! (Plus I learn something from here every day!)

I have several hidden rows. I want a macro to unhide ONLY the top row. When I do it manually, I unhide everything, then select all the cells below the first row of previously hidden data, and re-hide them.

Can a VBA macro do this for me?

Thank you.

PS - the hidden rows are in between 2 sections that are NOT hidden.



Posted by Damon Ostrander on June 27, 2001 2:38 PM

Hi Chris,

Here is a little macro that will always hide the topmost hidden row.

Sub UnhideFirstRow()
startrow = ActiveSheet.UsedRange.Row
stoprow = startrow + ActiveSheet.UsedRange.Rows.Count - 1
For i = startrow To stoprow
If Rows(i).Hidden Then
Rows(i).Hidden = False
Exit For
End If
Next i
End Sub


Happy computing.

Damon