Hiding Rows if a Field Value is set to 0%

  • Thread starter Thread starter George
  • Start date Start date
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!
 
Use Autofilter on the column that contains the percentage - choose
Custom, then Not Equal To, then 0 (zero).

Hope this helps.

Pete
 
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.
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top