1 réponse
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.
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.
Best regards,
Gael
Thank you !!