Hi all,
I would like to protect only the buttons on my sheet, I do not want to protect/lock the sheet I only want to keep users from accidentally changing or moving the button. When I tried protecting the sheet even with all the cells unlock the macro would not work. Thanks
I am using both Form control and ActiveX control in my sheet.
Any idea guys?
Protecting Command Button
-
- Administrator
- Posts: 78475
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Protecting Command Button
If you run your macro while the sheet is protected, what is the error message?
You might unprotect the sheet at the beginning of the macro, and protect it again at the end:
Substitute the correct password (if you don't use a password, omit the part Password:="secret").
You might unprotect the sheet at the beginning of the macro, and protect it again at the end:
Code: Select all
Sub MyMacro()
ActiveSheet.Unprotect Password:="secret"
' Your actions here
...
ActiveSheet.Protect Password:="secret"
End Sub
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 179
- Joined: 30 Sep 2014, 15:18
Re: Protecting Command Button
I have both Form control and ActiveX control in my same sheet . I would like to lock only those two command button but not the complete sheet.
Is it possible ?
Is it possible ?
-
- Administrator
- Posts: 78475
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- 2StarLounger
- Posts: 179
- Joined: 30 Sep 2014, 15:18
Re: Protecting Command Button
Thanks :)