[Excel] allow macro in protected sheet
herve3168
Posted messages
2
Registration date
Status
Member
-
LN -
LN -
Hello,
Desperate
How can I enable the use of macros in a protected sheet in EXCEL????
Thank you in advance.
Desperate
How can I enable the use of macros in a protected sheet in EXCEL????
Thank you in advance.
1 answer
-
Execute a macro on a protected sheet
You have just protected a sheet in your workbook with a password, but you would like to run a macro on this sheet. Unfortunately, the macro refuses to work and returns an error message.
To be able to run a macro on a protected sheet, you need to add an instruction that removes the protection before acting on the sheet and another that restores the protection at the end of the procedure.
Sub MacrowithProtectedSheet()
ActiveSheet.Unprotect "thepassword"
'Place your instructions here
ActiveSheet.Protect "thepassword", True, True, True
End Sub
Replace "thepassword" with your password that protects the sheet.