I want to lock/unlock a given sheet based on the value of a cell in another sheet. I wrote the following code:
Application.ScreenUpdating = False
Status = Sheets("form").Range("J2")
If Status = "Active" Then
Sheets("overview").Unprotect "password"
'MsgBox "The template is now unlocked"
Else
Sheets("overview").Protect "password"
'MsgBox "The template is locked"
End If
Application.ScreenUpdating = True
However, when Status is other than active I can still change some cells in overview getting a "Unable to set the hidden property of the Range class" popup. Where is the error?
