Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

if cell is blank or zero hide row below

$
0
0

If J79 is blank or zero, I need to hide rows 81-86.  I can get most of this to work except if I originally have something in the cell then blank it out.

I have also included others that usually work unless I blank them out:

If D30 = No or is blank hide rows 32-37

If D39 = no or is blank hide rows 41-46

If B95 = no or is blank hide row 97

if B99 = no or is blank hide row 101

the code I have used is as follows:

Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("D30")) Is Nothing Then
        Sheets("PROFILE LEVEL 1").Range("A32:A37").EntireRow.Hidden = Not (UCase$(Target.Value) = "YES")
    End If
    If Not Intersect(Target, Range("D39")) Is Nothing Then
        Sheets("PROFILE LEVEL 1").Range("A41:A46").EntireRow.Hidden = Not (UCase$(Target.Value) = "YES")
    End If
        If Not Intersect(Target, Range("B95")) Is Nothing Then
        Sheets("PROFILE LEVEL 1").Rows("97").EntireRow.Hidden = Not (UCase$(Target.Value) = "YES")
    End If
    If Not Intersect(Target, Range("B99")) Is Nothing Then
        Sheets("PROFILE LEVEL 1").Rows("101").EntireRow.Hidden = Not (UCase$(Target.Value) = "YES")
    End If
    If Not Intersect(Target, Range("D106")) Is Nothing Then
        Sheets("PROFILE LEVEL 1").Range("A109:A114").EntireRow.Hidden = Not (UCase$(Target.Value) = "YES")
    End If
    If Not Intersect(Target, Range("J79")) Is Nothing Then
        Sheets("PROFILE LEVEL 1").Range("A81:A86").EntireRow.Hidden = Not (UCase$(Target.Value) > "*")
    End If
End Sub


Viewing all articles
Browse latest Browse all 11829

Trending Articles