Protect Worksheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I wrote a macro to select certain options when reports on my worksheets are
being
printed. The sheets are then protected and when the macro is run, a message
appears stating that the commands could be accessed if the password is
entered (to remove the protection). How could I get the protection to
remain and get the macro to work.
Thanks
Lennox
 
Lennox

If using Excel 2002 or 2003 you have the option when protecting the sheet of
allowing users to do certain operations on the sheet.

Earlier versions would require a macro to unprotect then re-protect the sheet.

ActiveSheet.Unprotect Password:="justme"

'do your stuff

ActiveSheet.Protect Password:="justme", DrawingObjects:=True, _
Contents:=True, Scenarios:=True

Gord Dibben Excel MVP
 
Hi Gord,
I tried the code which you suggested and it works. Thanks very much.
Lennox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top