Hi Everyone,
I'm trying to write a simple VBA but I can't get it to work.
In the Worksheet code, I am trying to have the worksheet automatically hide certain rows based on a cell's value.
If cell E3 = IL, I would like rows 32-85 hidden
If cell E3 = ISA, I would like rows 12:31 hidden
If cell E3 = IL/ISA, I would like NO rows hidden
Would someone be able to advise as to what I am doing wrong with the code below:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("E3").Value = "IL" Then
Rows("32:85").EntireRow.Hidden = True
ElseIf Range("E3").Value = "ISA" Then
Rows("12:31").EntireRow.Hidden = True
End If
End Sub
Bookmarks