Monday 17 September 2012

VBA - Protect Sheet from User / Allow macro


Generally, if you want your vba code to run on a protected sheet, you wrap your code in unprotect/protect statements in every procedure or function. You also have to remember to protect the sheet in case it is unprotected. Here is the attached file that clearly explains how you can avoid this.

The following code in the Workbook_Open procedure/event protects all the sheets from the user but allows the macro code to work on the sheets.

No comments:

Post a Comment