Hi All,
I'm trying to add a command to a macro I found, but being a noob I think I know the command just not how to insert it correctly.
I have a toggle button which locks and unlocks a workbook and I would like to change the button text when pressed.
Assuming the following is the correct command to do so.
commandbutton1.caption = "xxxxxxxxx"
But how do I add it to this code?
Sub ToggleProtect()
Const PW As String = "test"
With Sheets(ActiveSheet.Name)
If .ProtectContents = False Then
.Protect PW
Else
.Unprotect PW
End If
End With
End Sub
Thanks in advance.
Bookmarks