Keep Worksheet Protection Settings in Excel Templates
Question details
Keep worksheet protection permissions consistent in reports generated from a macro-enabled Excel template.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A macro-enabled template creates protected report workbooks by copying worksheets or content and running macros.
- Observed behavior
- Generated reports sometimes have different worksheet protection settings.
Open the template in Excel and identify the intended protection password, allowed actions, and cell-selection permissions. Review the report-generation macro and note whether generated workbooks need to run macros after they are reopened.
Apply consistent protection at the end of report generation
Use this approach when macros create or modify report sheets and may apply different protection options.
In Excel, open each template sheet and select Review > Protect Sheet, or unprotect it first if needed. Record which actions users should be allowed to perform, including selecting locked and unlocked cells.
Open the VBA editor with Alt+F11 and find the code that copies sheets, creates report content, or calls Unprotect and Protect. Check that it uses the intended password and the same protection arguments for every report sheet.
In the generation macro, complete copying, formatting, and formulas before calling each report sheet's Protect method. Set UserInterfaceOnly and the required Allow options explicitly, and set the sheet's EnableSelection property to match the intended selection permissions.
Run the template's report-generation macro, open the resulting workbook, and test the allowed and blocked actions on each protected sheet. Repeat the test in the Excel version used by colleagues.

Verify protection after copying report sheets
Use this check when reports are assembled by copying worksheets or pasting content into new sheets.
Work with Excel report files in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for common Excel formats, making it easier to move everyday report work. Excel VBA protection behavior may differ, so verify macro compatibility before migrating automated templates.

Frequently Asked Questions
Why do generated reports have different protection settings?
A macro may protect sheets with different arguments, or content may be pasted into a new sheet without the intended settings. Review the code in the VBA editor and test the permissions on each generated sheet.
Does UserInterfaceOnly stay enabled after I reopen a workbook?
No. Excel does not retain that setting after the workbook closes. If the reopened workbook's macros need it, reapply protection in Workbook_Open and ensure the workbook retains VBA code and macros are allowed to run.
How do I control whether users can select locked cells?
In Excel, check the selection options under Review > Protect Sheet. In VBA, set the worksheet's EnableSelection property consistently with the permissions you want.
Should I protect a report sheet before or after creating its content?
Complete the report's copying, formatting, and formulas first, then apply protection with the intended password and permissions. This gives the generation macro a consistent final protection step.




