Hi, I'm quite poor on excel and have been trying to research and learn the answer myself but I cannot.
My code below is trying to hide a row when the answer above is answered YES and unhide when the answer is NO. I can get the code to work for one row but cannot seem to get the code to run for all 4 rows. Please help me before I smash my new laptop...
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B9").Value = "Yes" Then
Rows("10:10").EntireRow.Hidden = True
ElseIf Range("B9").Value = "No" Then
Rows("10:10").EntireRow.Hidden = False
If Range("B12").Value = "Yes" Then
Rows("13:13").EntireRow.Hidden = True
ElseIf Range("B12").Value = "No" Then
Rows("13:13").EntireRow.Hidden = False
If Range("B14").Value = "Yes" Then
Rows("15:15").EntireRow.Hidden = True
ElseIf Range("B14").Value = "No" Then
Rows("15:15").EntireRow.Hidden = False
If Range("B18").Value = "Yes" Then
Rows("19:19").EntireRow.Hidden = True
ElseIf Range("B18").Value = "No" Then
Rows("19:19").EntireRow.Hidden = False
End If
End Sub
My code below is trying to hide a row when the answer above is answered YES and unhide when the answer is NO. I can get the code to work for one row but cannot seem to get the code to run for all 4 rows. Please help me before I smash my new laptop...
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B9").Value = "Yes" Then
Rows("10:10").EntireRow.Hidden = True
ElseIf Range("B9").Value = "No" Then
Rows("10:10").EntireRow.Hidden = False
If Range("B12").Value = "Yes" Then
Rows("13:13").EntireRow.Hidden = True
ElseIf Range("B12").Value = "No" Then
Rows("13:13").EntireRow.Hidden = False
If Range("B14").Value = "Yes" Then
Rows("15:15").EntireRow.Hidden = True
ElseIf Range("B14").Value = "No" Then
Rows("15:15").EntireRow.Hidden = False
If Range("B18").Value = "Yes" Then
Rows("19:19").EntireRow.Hidden = True
ElseIf Range("B18").Value = "No" Then
Rows("19:19").EntireRow.Hidden = False
End If
End Sub