The following is something I've lifted from another post as being a suitable solution for something I want to do in a spreadsheet - ie hide certain rows when a cell is set to certain values. The problem is I have no idea how and where to apply it to my spreadsheet. Can you point me in the right direction please. Also - are any of the names here dependent on the name of the sheet I'm applying it to or are they generic? Once I get this in and amended I'm sure it will help me along my learning curve. Thanks
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1").Value = "1" Then
Rows("2:95").EntireRow.Hidden = False
Rows("3:11").EntireRow.Hidden = True
Rows("15").EntireRow.Hidden = True
Rows("19").EntireRow.Hidden = True
Rows("20:50").EntireRow.Hidden = True
ElseIf Range("A1").Value = "2" Then
Rows("2:95").EntireRow.Hidden = False
Rows("3:10").EntireRow.Hidden = True
Rows("15").EntireRow.Hidden = True
Rows("29:52").EntireRow.Hidden = True
Rows("82").EntireRow.Hidden = True
ElseIf Range("A1").Value = "3" Then
Rows("2:95").EntireRow.Hidden = False
Rows("3:20").EntireRow.Hidden = True
Rows("95").EntireRow.Hidden = True
ElseIf Range("A1").Value = "4" Then
Rows("2:95").EntireRow.Hidden = False
Rows("8:10").EntireRow.Hidden = True
Rows("12").EntireRow.Hidden = True
Rows("14").EntireRow.Hidden = True
Rows("16").EntireRow.Hidden = True
Rows("18").EntireRow.Hidden = True
Rows("20").EntireRow.Hidden = True
Rows("22").EntireRow.Hidden = True
Rows("2:60").EntireRow.Hidden = True
End If
End Sub
Bookmarks