How to Make VBA Radio Buttons Work on a Protected Excel Worksheet
Question details
The user needs to ensure VBA-controlled radio buttons function correctly when an Excel worksheet is protected.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Clicking or triggering ActiveX radio buttons (option buttons) via VBA macros on a locked and protected Excel worksheet.
- Observed behavior
- The radio buttons stop working or trigger VBA runtime errors because the controls are locked, or the macro is protecting/unprotecting the wrong worksheet before modifying rows.
Before making changes, create a backup copy of your workbook to prevent data loss during macro testing, and make sure you have the password used to protect the worksheet.
Unlock the ActiveX Radio Button Control
Prevent the worksheet protection from locking the radio button by modifying its control properties so users can still click it.
By default, all cells and objects in Excel are marked as 'Locked', which takes effect once the worksheet is protected. Unlocking the specific radio button allows interaction even when the sheet is protected.
Go to the 'Review' tab on the Excel ribbon and click 'Unprotect Sheet'. Enter your password if prompted.
Navigate to the 'Developer' tab and click 'Design Mode' so you can select and edit ActiveX controls without triggering their macros.
Right-click the problematic radio button (option button) and select 'Format Control' or 'Properties' from the context menu.
In the Format Control dialog, go to the 'Protection' tab, clear the 'Locked' check box, and click 'OK'.
Turn off 'Design Mode' in the Developer tab, then go back to the 'Review' tab and click 'Protect Sheet' to reapply your security settings.

Modify VBA Code to Unprotect and Reprotect the Sheet
Update your VBA macro to temporarily remove worksheet protection, execute the necessary changes, and re-apply protection automatically.
Easily Manage Macros and Form Controls with WPS Spreadsheet
WPS Office offers a highly compatible Spreadsheet application that seamlessly supports VBA macros, ActiveX controls, and worksheet protection, making it effortless to troubleshoot and run customized forms.
- 1. Download and Install WPS Office: Get WPS Office from the official website and open your .xlsm file in WPS Spreadsheet.
- 2. Access Developer Tools: Navigate to the 'Developer' tab to access the VBA Editor, Design Mode, and Form Controls.
- 3. Manage Worksheet Protection: Use the 'Review' tab to easily protect or unprotect your worksheet while testing your interactive radio buttons.

Frequently Asked Questions
Why do my Excel macros fail when the worksheet is protected?
When a worksheet is protected, locked cells and objects cannot be modified. If your macro attempts to change locked cells (like hiding rows) or interact with locked controls without unprotecting the sheet first, Excel triggers a runtime error.
Can I allow macros to run on a protected sheet without unprotecting it?
Yes, you can use the `UserInterfaceOnly:=True` argument when applying worksheet protection via VBA upon opening the workbook. This allows macros to make changes seamlessly while keeping the user interface locked for manual edits.
Where do I find the Developer tab to edit ActiveX radio buttons?
If the Developer tab is hidden, go to File > Options > Customize Ribbon. Check the box next to 'Developer' in the right pane and click OK. This will reveal the tab, giving you access to Design Mode and VBA properties.




