Hi all- I don't know VB but need to accomplish hiding different ranges of rows in my spreadsheet based on the value of a field. The field options for cell f9 are 1-4. If '1' is entered in f9, then I have a range of rows below f9 to hide that don't apply. The same is true for 2 and 3. If 4 is entered, then I want all the rows to show. By searching the internet, I pieced together the following code but it doesn't work. Can you help me fix it. Thanks.
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("$f$9").Value = "1" Then
Rows("56:201").EntireRow.Hidden = True
ElseIf Range("$f$9").Value = "2" Then
Rows("104:201").EntireRow.Hidden = True
ElseIf Range("$f$9").Value = "3" Then
Rows("153:201").EntireRow.Hidden = True
ElseIf Range("$f$9").Value = "4" Then
Rows("56:201").EntireRow.Hidden = False
End If
End Sub
Bookmarks