Oprichnick
Board Regular
- Joined
- May 30, 2013
- Messages
- 69
Hello, I'm trying to use a toggle button to protect and unprotect a worksheet. I have this code
Although, It works (in a sense that the toggle button in fact protects/unprotects the sheet), Excel doesn't ask me the password each time I press the button to unprotect the sheet. Which is also what I want. Thank for your help in advance. Regards
Code:
Private Sub ToggleButton1_Click()
If ActiveSheet.ProtectContents = True Then
ActiveSheet.Unprotect "test"
Else
ActiveSheet.Protect "test"
End If
End Sub
Although, It works (in a sense that the toggle button in fact protects/unprotects the sheet), Excel doesn't ask me the password each time I press the button to unprotect the sheet. Which is also what I want. Thank for your help in advance. Regards