Just wondering if someone would be able to help me with the code required to create a button for protecting the worksheet and a button for unprotecting the worksheet
Just wondering if someone would be able to help me with the code required to create a button for protecting the worksheet and a button for unprotecting the worksheet
Last edited by torontoguy; 01-22-2009 at 09:39 AM.
Add a button from the Control ToolBox then use this code
![]()
Please Login or Register to view this content.
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
there seemed to be a problem with that code
"compile error"
invalid use of me keyword
Have you used a button from the Controls ToolBox & where have you placed the code?
noob question: where do i find the create command button in xl 2007?
If I remember correctly it is in the Developer Tab -> Insert
perfect
thank you!
Glad it helped
ah darn, I have a problem... the password doesnt seem to be working. I tried with the change: 1234 instead of secret but it doesnt seem to ask for it when clicking "unprotect worksheet"
That's because the password is hard coded, do you want to ask for the password? This will add the password automatically & prompt for unprotecting
O![]()
Please Login or Register to view this content.
awesome. thanks again!
Last edited by torontoguy; 01-22-2009 at 09:50 AM.
If you could please delete the message above
AND here's my problem:
-when a user enters the wrong password, it takes them to the debugger
which contains the code for the button.. and unfortunately, the password
as well
You can stop the debugger by protecting the vba project which is a must where passwords are involved.
Add error handler to alert about wrong password
![]()
Please Login or Register to view this content.
Awesome. It works great! (I guess you expected that)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks