Hiding Rows if a Field Value is set to 0%

G

George

Hello,
I have a worksheet with some rows that are only applicable if the percentage
value in another field is greater than 0%. Otherwise, I want those rows to be
hidden.
Can anyone help me figure out how to do this?

Thanks very much!
 
P

Pete_UK

Use Autofilter on the column that contains the percentage - choose
Custom, then Not Equal To, then 0 (zero).

Hope this helps.

Pete
 
G

George

Thanks but I don't think that will work for me.
I have a field (D1) where the user can enter a percentage.
That value drives formulas on 16 other fields (4Rx4C) which are always 0 if
the field value is 0% (the default value). Therefore, they should remain
hidden.
BUT, if the user enters anything other than 0%, I want 16 other fields to
appear.
 
G

Gord Dibben

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("D1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
If .Value = 0 Then
Rows("6:9").Hidden = True
Else
Rows("6:9").Hidden = False
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP
 
G

George

Thanks! That did it.

Gord Dibben said:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("D1")) Is Nothing Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Target
If .Value = 0 Then
Rows("6:9").Hidden = True
Else
Rows("6:9").Hidden = False
End If
End With
CleanUp:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP
 
Top