Protection controlled by macro

  • Thread starter Thread starter Crownman
  • Start date Start date
C

Crownman

I have a worksheet that is password protected. I want to create a
macro that will unprotect the worksheet, perform several operations,
and then reprotect the worksheet using the same password.

I have tried including the password within the macro to unprotect and
reprotect the worksheet, but I still get prompted for the password when
the macro runs.

Does anyone have any suggestions on how this can be accomplished?

Thanks for any help.

Crownman
 
As ALWAYS, post your coding efforts for comments and suggestions.
 
ActiveSheet.Unprotect Password:="justme"
'do your stuff
ActiveSheet.Protect Password:="justme"


Gord Dibben MS Excel MVP
 
Thanks for the answer, Gord. This is exactly what I needed.

Crownman
 

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