View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
marcus[_3_] marcus[_3_] is offline
external usenet poster
 
Posts: 140
Default hide multiple rows based on condition within rows

Hi

This should do the trick. Starts in Cell A18, checks the length of
Col A and hides the rows with TRUE in them. The Unhide procedure
unhides everything.

Hope this helps.

Marcus

'Procecdure to hide.

Sub Hide()
Dim Z As Long
Dim x As Range

Z = Range("A" & Rows.Count).End(xlUp).Row
Set x = Range("A2:A" & Z)

Application.ScreenUpdating = False
For Each Cell In Range("A18:A" & Z)
Cell.EntireRow.Hidden = Cell.Value = True

Next Cell

End Sub


'Procecdure to unhide.
Sub UnHide()
Dim Z As Long
Dim x As Range

Z = Range("A" & Rows.Count).End(xlUp).Row
Set x = Range("A2:A" & Z)

Application.ScreenUpdating = False
For Each Cell In Range("A18:A" & Z)
Cell.EntireRow.Hidden = False
Next Cell

End Sub