Hello all!
I am trying to use this code on VBA. However, it is not working. Nothing happens when I change cell A1. Any idea why?
Thank you!
I am trying to use this code on VBA. However, it is not working. Nothing happens when I change cell A1. Any idea why?
VBA Code:
Private Sub Worksheet_Change2(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
ActiveSheet.Unprotect Password:="123"
Application.ScreenUpdating = False
With Sheets("Sheet2")
Select Case Target.Address
Case "$A$1"
Select Case Target.Value
Case Is = 1
.Rows("107:323").EntireRow.Hidden = True
.Rows("36:106").EntireRow.Hidden = False
Case Is = 2
.Rows("37:107").EntireRow.Hidden = True
.Rows("108:177").EntireRow.Hidden = False
.Rows("178:323").EntireRow.Hidden = True
Case Is = 3
.Rows("37:179").EntireRow.Hidden = True
.Rows("180:250").EntireRow.Hidden = False
.Rows("178:323").EntireRow.Hidden = False
Case Is = 4,5
.Rows("37:252").EntireRow.Hidden = True
.Rows("253:324").EntireRow.Hidden = False
End Select
End If
ActiveSheet.Protect Password:="123"
Application.ScreenUpdating = True
End Sub
Thank you!