A
AVR
I am working in a sheet with 2 different data validation cells, named as
ranges "DV1" and "DV2" respectively. The only values for the cells are "Yes"
or "No". When one of those 2 cells changes, I want to hide or unhide other
sheets, based on the value in the changed cell. The following code is
running, but the visibility of the sheets is unaffected. What am I doing
wrong?
'Private Sub Worksheet_Change(ByVal Target As Range)
'
' a = Target.Address
' b = Target.Value
' x = Range("DV1").Address
' y = Range("DV2").Address
'
' If a = x Then
'
' If b = "Yes" Then
' Sheets("ShDV1A").Visible = True
' Sheets("ShDV1B").Visible = True
' Else
' Sheets("ShDV1A").Visible = False
' Sheets("ShDV1B").Visible = False
' End If
'
' ElseIf a = y Then
'
' If b = "Yes" Then
' Sheets("ShDV2A").Visible = True
' Sheets("ShDV2B").Visible = True
' Else
' Sheets("ShDV2A").Visible = False
' Sheets("ShDV2B").Visible = False
' End If
'
' End If
'
'
'End Sub
ranges "DV1" and "DV2" respectively. The only values for the cells are "Yes"
or "No". When one of those 2 cells changes, I want to hide or unhide other
sheets, based on the value in the changed cell. The following code is
running, but the visibility of the sheets is unaffected. What am I doing
wrong?
'Private Sub Worksheet_Change(ByVal Target As Range)
'
' a = Target.Address
' b = Target.Value
' x = Range("DV1").Address
' y = Range("DV2").Address
'
' If a = x Then
'
' If b = "Yes" Then
' Sheets("ShDV1A").Visible = True
' Sheets("ShDV1B").Visible = True
' Else
' Sheets("ShDV1A").Visible = False
' Sheets("ShDV1B").Visible = False
' End If
'
' ElseIf a = y Then
'
' If b = "Yes" Then
' Sheets("ShDV2A").Visible = True
' Sheets("ShDV2B").Visible = True
' Else
' Sheets("ShDV2A").Visible = False
' Sheets("ShDV2B").Visible = False
' End If
'
' End If
'
'
'End Sub