Macro in a protected worksheet
Hi Paul,
If the macros run but then produce an error then you should be able to
get them to work by including a line of code that unprotects the sheet.
This line will have to come before any other code lines that attempt to
change the sheet. If the protection was applied without a password then
just use...
ActiveSheet.Unprotect
If password eg 123 was used then use..
ActiveSheet.Unprotect(123)
After the macro code has done all its changes to the sheet the code can
reinstate the protection with the final line..
ActiveSheet.Protect 'if no password OR...
ActiveSheet.Protect(123) 'if password is 123
Ken Johnson
|