-
There is no macro option to assign...I place this code in the sheet...could it be that I want the macro to work with a shape and not the commandbutton
Code:
Private Sub CommandButton1_Click()
Dim strPassword As String
Const strActualPassword As String = "ABCD"
strPassword = InputBox("Please enter the password", "Protect/Unprotect Sheet")
If strActualPassword = strPassword Then
If Me.CommandButton1.Caption = "PROTECT SHEET" Then
Me.CommandButton1.Caption = "UNPROTECT SHEET"
Me.Protect Password:=strPassword
Else
Me.CommandButton1.Caption = "PROTECT SHEET"
Me.Unprotect Password:=strPassword
End If
Else
MsgBox "Invalid Password"
End If
End Sub
-