MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Protect w/ passwords in Macro


Posted by Mark on December 02, 2001 7:23 PM

How do I use passwords for sheet protection in macros? I want to protect and unprotect sheets in macros but when I put password protection on a sheet I have to type in the macro even during macro execution. How do I avoid this during the running of a macro?

Thanks -


Posted by Tom Dickinson on December 02, 2001 9:04 PM

Posted by Tom Dickinson on December 02, 2001 9:06 PM

Worksheets("sheet name").Protect "password",the types of protection

to unprotect:

Worksheets("sheet name").Unprotect "password"