Hi everyone,
I am trying to write a code that hides columns based off of a cell range. So if "Dog" is anywhere in B18 to B25, then columns N:X will disappear.
Here is my code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B18:B25").Value = "Dog" Then
Columns("N:X").EntireColumn.Hidden = False
Else
Columns("N:X").EntireColumn.Hidden = True
End If
End Sub
Even if I use just cell B18, columns N:X still disappear when Dog is entered, when it should not be disappearing.
I'm sure this is pretty simple, but I have been stuck on it for about a day and need some help. Thanks for the help!
I am trying to write a code that hides columns based off of a cell range. So if "Dog" is anywhere in B18 to B25, then columns N:X will disappear.
Here is my code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B18:B25").Value = "Dog" Then
Columns("N:X").EntireColumn.Hidden = False
Else
Columns("N:X").EntireColumn.Hidden = True
End If
End Sub
Even if I use just cell B18, columns N:X still disappear when Dog is entered, when it should not be disappearing.
I'm sure this is pretty simple, but I have been stuck on it for about a day and need some help. Thanks for the help!