Hiding sequential rows during a macro


Posted by Mark on November 25, 2001 6:01 PM

I am trying to print a summary report in a macro that will automatically hide any row where the value in column 2 is 0. I need to evaluate rows 18 - 186 and hide each non-essential row.

Thanks -

Mark



Posted by Luis B on November 25, 2001 7:17 PM

This should be very close to what you need.
Good luck,
Luis

Sub Button1_Click()
' Code to hide rows that are zero or have nothing in
For Each cell In Range("A1:A" &ActiveCell.SpecialCells(xlCellTypeLastCell).Row)
Select Case cell.Value
Case Is = 0
cell.EntireRow.Hidden = True
Case Is = ""
cell.EntireRow.Hidden = True
End Select
Next cell

End Sub