How to Change an Excel Form Control Checkbox in a Shared Workbook
Question details
The user needs a workaround for changing the state of Excel Form Control checkboxes via VBA in a shared workbook without triggering an error.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Executing a VBA macro that loops through ActiveSheet.CheckBoxes to change their values (e.g., to xlOff) in a workbook that has been shared.
- Observed behavior
- The macro functions correctly in an unshared workbook but throws runtime error 1004 once the workbook is shared, as shared workbooks restrict direct object modifications.
Temporarily unshare your workbook so you can safely edit Form Control properties and assign linked cells before reapplying the shared status.
Use Linked Cells Instead of Direct Object Modification
By linking each checkbox to a specific worksheet cell, you can update the cell's value via VBA. The checkbox will automatically reflect the cell's state, bypassing the shared workbook restriction on object modification.
Legacy shared workbooks in Excel do not permit direct modifications to shapes or Form Control objects using VBA. When your code targets ActiveSheet.CheckBoxes directly, it triggers a runtime error 1004.
To circumvent this limitation, you can rely on the native 'Cell link' property of Form Controls. Modifying the data inside a cell is fully supported in shared workbooks.
Right-click the Form Control checkbox in your unshared workbook and select 'Format Control'. Go to the 'Control' tab, click inside the 'Cell link' box, and select a cell (e.g., A1). Click 'OK'.
Since the linked cell will display 'TRUE' or 'FALSE', you can format the cell text color to match the background color (like white on white) or hide the entire column to keep your sheet looking clean.
Open your VBA editor and rewrite the macro to target the linked cell instead of the checkbox object. For example, replace 'ActiveSheet.CheckBoxes(1).Value = xlOff' with 'Range("A1").Value = False'.
Save the changes, go to the Review tab, and re-enable workbook sharing. Run your updated VBA macro to ensure the checkbox updates seamlessly without triggering runtime error 1004.

Handle Spreadsheets and Macros Smoothly with WPS Office
If legacy shared workbook limitations and VBA runtime errors in Microsoft Excel are slowing down your workflow, consider using WPS Office. It provides robust spreadsheet capabilities and an intuitive interface designed for modern productivity.
- 1. Download WPS Office: Visit the official WPS website and download the free installation package.
- 2. Install the Software: Run the installer and follow the quick setup wizard to install WPS Office on your device.
- 3. Open Your Spreadsheet: Launch WPS Spreadsheets and directly open your existing .xlsm files to continue working with your macros and form controls.

Frequently Asked Questions
Why does runtime error 1004 happen only when the workbook is shared?
Legacy shared workbook functionality in Excel imposes strict restrictions on modifying structural elements and objects. Attempting to programmatically change properties of shapes, charts, or Form Controls (like checkboxes) is blocked to prevent synchronization conflicts, resulting in runtime error 1004.
Can I use ActiveX checkboxes as an alternative in shared workbooks?
No, ActiveX controls are subject to similar, if not stricter, limitations within shared workbooks. They often fail to update properly and can lead to file corruption. Sticking to Form Controls with linked cells remains the most reliable method.
How do I quickly assign linked cells to multiple checkboxes using VBA?
While the workbook is unshared, you can run a temporary VBA script that loops through all checkboxes and assigns their 'LinkedCell' property to an adjacent cell (for example, using the checkbox's TopLeftCell property offset by one column). Once assigned, delete the script and re-share the workbook.




