Hi all,
Please can anyone help with this?
I've used the following but if I insert a new row before the selected rows (i.e. before row 16), the code then doesn't work anymore. How can I make sure the code is locked to the cell I selected?
Please can anyone help with this?
I've used the following but if I insert a new row before the selected rows (i.e. before row 16), the code then doesn't work anymore. How can I make sure the code is locked to the cell I selected?
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Activate
If Not Application.Intersect(Range("F14"), Range(Target.Address)) Is Nothing Then
Select Case Target.Value
Case Is = "A":
Rows("16:32").EntireRow.Hidden = True
Case Is = "B":
Rows("16:19").EntireRow.Hidden = False
Rows("20:32").EntireRow.Hidden = True
Case Is = "C":
Rows("16:19").EntireRow.Hidden = True
Rows("20:31").EntireRow.Hidden = False
Rows("32").EntireRow.Hidden = True
Case Is = "D":
Rows("16:31").EntireRow.Hidden = True
Rows("32").EntireRow.Hidden = False
End Select
End If
Last edited by a moderator: