Hi,
I have below code in a protected worksheet and the sheet automatically become unprotected if i enter value in any cell.
Someone help me to alter the code, if i select "Yes" in Cell No:F50, then the Rows("51:59") need to unhide and allows users to enter data but the sheet should not unprotect.Or else the rows remain Hidden.
I have below code in a protected worksheet and the sheet automatically become unprotected if i enter value in any cell.
Someone help me to alter the code, if i select "Yes" in Cell No:F50, then the Rows("51:59") need to unhide and allows users to enter data but the sheet should not unprotect.Or else the rows remain Hidden.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Me.Unprotect Password:="password"
If Not Application.Intersect(Range("F50"), Range(Target.Address)) Is Nothing Then
Select Case Target.Value
Case Is = "Select": Rows("51:59").EntireRow.Hidden = True
Case Is = "No": Rows("51:59").EntireRow.Hidden = True
Case Is = "Yes": Rows("51:59").EntireRow.Hidden = False
Me.Protect Password:="password"
End Select
[ /Code]
End If
End Sub