View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
David Adamson[_4_] David Adamson[_4_] is offline
external usenet poster
 
Posts: 61
Default Macro to hide rows based on a zero value in a particular cell

Just adopted something from the group. Sorry can't remember name



'make cells dispapear
Sub Button1_Click()
Dim cell As Range
Application.ScreenUpdating = False
For Each cell In Range("A1:A60")

If cell.Font.Bold = False Then
If cell.Value = 0 Then
cell.EntireRow.Hidden = True
ElseIf cell.Value < 0 Then
cell.EntireRow.Hidden = False
End If
End If
Next
Application.ScreenUpdating = True

End Sub

'make all cells reappear
Sub Button2_Click()
Dim cell As Range

For Each cell In Range("A1:A60")
cell.EntireRow.Hidden = False
Next
Application.ScreenUpdating = True

End Sub



"Peter" wrote in message
...
How complicated is it to create a macro to hide rows
conditioned upon a zero value in a particular column of
that row? Could a second condition also be added to test
for bold font type zeros to not be hidden? I have a VERY
large cost estimating spreadsheet with 2,000 rows of
items, and want to be able to hide rows that do not
apply. Summary rows are in bold type and I would like to
retain them, but hide all the detail. It takes forever
manually!.