I am creating a document that has a list of items, which I would like to appear or be hidden, depending on certain dropdowns.
I've run into an issue where one dropdown box in cell E30 is conditional.
I need:
IF E30 = 'No' AND E6 = 'VIC'
Then Rows 1:45 are not hidden AND Rows 46:81 are hidden
IF E30 = 'Yes' AND E6 = 'VIC'
Then Rows 1:33 are not hidden AND Rows 34:81 are hidden
IF E30 = 'No' AND E6 = 'OTHER'
Then Rows 1:33 and 64:81 are not hidden AND Rows 34:63 are hidden
IF E30 ='Yes' AND E6 ='OTHER'
Then Rows 1:33 are not hidden AND Rows 34:81 are hidden
The following is the code I have so far.
The first group is working as designed.
The second is the above partial code I have a problem with.
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Activate
If Not Application.Intersect(Range("E19"), Range(Target.Address)) Is Nothing Then
Select Case Target.Value
Case Is = "NO": Rows("34:81").EntireRow.Hidden = True
Rows("1:22").EntireRow.Hidden = False
Rows("23:33").EntireRow.Hidden = False
Case Is = "YES": Rows("23:81").EntireRow.Hidden = True
Rows("1:22").EntireRow.Hidden = False
End Select
End If
ActiveSheet.Activate
If Not Application.Intersect(Range("E30"), Range(Target.Address)) Is Nothing Then
Select Case Target.Value
Case Is = "YES": Rows("34:81").EntireRow.Hidden = True
Rows("1:33").EntireRow.Hidden = False
Case Is = "NO": Rows("34:63").EntireRow.Hidden = True
Rows("1:33").EntireRow.Hidden = False
Rows("64:81").EntireRow.Hidden = False
End Select
End If
End Sub