MrExcel Publishing
Your One Stop for Excel Tips & Solutions

unprotect/reprotect sheet within macro


Posted by keith kemble on February 11, 2002 8:06 AM

In my macro routine, which works fine, I wish to unprotect the sheet in order to copy, then reprotect the sheet after pasting.

Would this be the PasswordChar function ?

The help section of excel is not clear.
I thought I saw a routine with in the message board but cannot find it.

Any help


Posted by Tom Urtis on February 11, 2002 9:11 AM

One example would be:

ActiveSheet.Unprotect ("PASSWORD")
'Your code
ActiveSheet.Protect ("PASSWORD")

Of course, substitute PASSWORD here for whatever password you want.

Tom Urtis

Posted by keithkemble on February 11, 2002 10:01 AM