Protection controlled by macro

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
 
G

Gord Dibben

ActiveSheet.Unprotect Password:="justme"
'do your stuff
ActiveSheet.Protect Password:="justme"


Gord Dibben MS Excel MVP
 

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

Top