VBA & Macro Problems

Prevent Users from Editing Formulas on a Protected WPS Spreadsheet Worksheet

Ayan MasoodAyan Masood Nov 13, 2026 869 views

Question details

The user needs to prevent formula cells from being edited after worksheet protection is applied, including after repeated double-clicks appear to make locked formula cells editable.

Prevent Users from Editing Formulas on a Protected WPS Spreadsheet Worksheet
Product
WPS Office Spreadsheets
Device & OS
not provided
Scenario
The user manages a shared workbook and wants formula cells to remain read-only for other users.
Observed behavior
On a protected worksheet, locked formula cells can still become editable after repeated double-clicks, allowing unauthorized formula changes.
Before you start

Open the workbook in WPS Office Spreadsheets and confirm that you have permission to change worksheet protection and macro settings. If you plan to use VBA, save the file in a macro-enabled format and enable macros when prompted.

Solution 1Recommended

Lock formula cells and protect the worksheet in WPS Office Spreadsheets

Use this method first because it applies built-in worksheet protection that keeps formula cells read-only for most users.

1
Select all cells and open Format Cells

Press Ctrl+A to select the entire sheet, right-click any selected cell, and choose Format Cells.

2
Lock only the formula cells

On the Protection tab, clear Locked and click OK. Then click Home > Find & Select > Go To Special, choose Formulas, click OK, right-click a selected formula cell, choose Format Cells > Protection, and check Locked.

3
Protect the worksheet

Click Review > Protect Sheet, enter a password if needed, and under Allow all users of this worksheet to, leave only Select locked cells and Select unlocked cells checked.

4
Save and test the protection

Save the workbook and try editing a formula cell as another user would. If editing is blocked, the built-in protection is active.

Lock formula cells and protect the worksheet in WPS Office Spreadsheets
Protection applied: Formula cells are now read-only unless the sheet protection is removed or the edit is performed through an unexpected program behavior.
WPS Office Spreadsheets

Protect Formula Cells in WPS Office Spreadsheets Without Rebuilding Your Excel Workbook

Open your Excel workbook in WPS Office Spreadsheets, lock formula cells, protect the worksheet, and optionally add a Worksheet_Change macro to undo unexpected edits while keeping full Excel compatibility.

  1. 1. Open the workbook in WPS Office Spreadsheets: Launch WPS Office, click Open, and select the .xlsx or .xlsm file you need to protect.
  2. 2. Select and lock formula cells: Press Ctrl+A, right-click and choose Format Cells > Protection, clear Locked, click OK; then use Home > Find & Select > Go To Special > Formulas, right-click a selected formula cell and check Locked.
  3. 3. Protect the worksheet: Click Review > Protect Sheet, set a password, and allow only Select locked cells and Select unlocked cells.
  4. 4. Optionally add the VBA undo safeguard: Press Alt+F11, double-click the sheet module, and paste the Worksheet_Change code that runs Application.Undo when Target.Locked is True.
  5. 5. Save and test the result: Save the workbook in macro-enabled format if macros are used, then test editing and double-clicking formula cells to confirm the protection works.
Keeps formula cells read-only with password-protected worksheet protectionSupports .xlsx and .xlsm Microsoft Excel formatsFamiliar Excel-like ribbon, menus, and VBA macro environmentFree and lightweight alternative for opening, editing, and protecting Excel workbooks
microsoft office alternative - wps office

Frequently Asked Questions

Why do locked formula cells become editable after double-clicking on a protected Excel worksheet?

This can happen because of unexpected Excel or WPS behavior that bypasses normal edit blocking after repeated double-clicks. Locking formula cells and protecting the worksheet helps, and a Worksheet_Change Application.Undo macro can reverse unintended edits.

Does WPS Office support worksheet protection and VBA macros in Excel files?

Yes. WPS Office Spreadsheets supports cell locking, sheet protection, and VBA macros in compatible versions. Save the workbook in a macro-enabled format such as .xlsm if you use VBA.

How do I select only formula cells in WPS Office Spreadsheets?

Click Home > Find & Select > Go To Special, choose Formulas, and click OK. Then right-click a selected formula cell, choose Format Cells > Protection, and check Locked.

Will an Application.Undo macro make a protected worksheet completely secure?

No. The macro only reverses edits after they occur and will not run if macros are disabled. Use it as a practical safeguard together with sheet protection, passwords, and access controls.