MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Unprotect Macro


Posted by lucky on February 05, 2002 8:41 AM

Hi All
I am wishing to run a macro that unprotects and protects the activesheet at the beginning and end of a procedure. I have many similar sheets I wish to apply this to. The trick is that the password is actually held as a reference number in cell D8 and therefore attempted this (at the start):
ActiveSheet.Unprotect (" & ActiveSheet.Range ""d8"" & ")
which didn't work.
Any ideas??
Cheers!



Posted by Jack in the Uk on February 05, 2002 11:52 AM


Hi--
Check out the archive section these tonns of this protection in VBA to get you well started, have a sift back in archives..should give you all you need.

HTH
Jack

Posted by faster on February 05, 2002 2:40 PM

Maybe use a variable:

Dim MyPW
MyPW = Range("D8").Text
ActiveSheet.Unprotect (MyPW)
'your code
ActiveSheet.Protect (MyPW)


Posted by faster on February 05, 2002 2:41 PM

Oops, I guess I needed to refresh board.