View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default protection with password

activesheet.protect Password:="ABCD"

activesheet.unprotect Password:="ABCD"

look in excel vba help for other arguments to protect and unprotect.

Also, try recording a macro while you do it manually (assigning a password
as well).

--
Regards,
Tom Ogilvy

"Bob" wrote in message
...
I have a macro that turns worksheet protection off before
it runs, then turns it back on after it's done.

Can I embed a password in the macro instructions that
activate and deactivate protection so that a user cannot
just go through the menu to turn off the protection?