Hello
while this isn't at all important it is driving me insane because it doesn't work. I really only wanted to have a button on the sheet while I'm designing the sheet so I can unprotect it without a password. I know I can do this with 2 buttons, or I can disable the code that's causing it to lock in the first place but I would really like to know why this doesn't work? it locks the sheet without a password but won't unlock it.
thanks in advance
while this isn't at all important it is driving me insane because it doesn't work. I really only wanted to have a button on the sheet while I'm designing the sheet so I can unprotect it without a password. I know I can do this with 2 buttons, or I can disable the code that's causing it to lock in the first place but I would really like to know why this doesn't work? it locks the sheet without a password but won't unlock it.
thanks in advance
VBA Code:
Sub LockUnlock()
If ActiveSheet.Protect = True Then
ActiveSheet.Unprotect "mypassword"
Else
ActiveSheet.Protect "mypassword"
End If
End Sub