I wrote the below script, but it is not working as I intended. I would like to view a certain range based on the text in cell A1. However, if i change the value more than once, a number of rows are hidden instead of the expected range. Any help would be greatly appreciated. Thanks.
Private Sub My_test_Case()
Select Case Range("$A$1").Text
Case Is = "tom"
Rows("3:4").Select
Case Is = "steve"
Rows("5:6").EntireRow.Hidden = True
Case Is = "tom"
Rows("7:8").EntireRow.Hidden = True
Case Is = "rich"
Rows("9:14").EntireRow.Hidden = True
Case Else
Rows("3:14").Select
Selection.EntireRow.Hidden = False
End Select
End Sub
Private Sub My_test_Case()
Select Case Range("$A$1").Text
Case Is = "tom"
Rows("3:4").Select
Case Is = "steve"
Rows("5:6").EntireRow.Hidden = True
Case Is = "tom"
Rows("7:8").EntireRow.Hidden = True
Case Is = "rich"
Rows("9:14").EntireRow.Hidden = True
Case Else
Rows("3:14").Select
Selection.EntireRow.Hidden = False
End Select
End Sub