How to Clear Checkboxes on the Active Excel Worksheet Using VBA
Question details
The user needs to modify a VBA macro so that clicking a button clears checkboxes exclusively on the current active worksheet rather than across the entire workbook, with a follow-up requirement to include checkboxes that are grouped together.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Modifying a VBA script triggered by clicking an object (like a shape or button) to reset form controls on a specific sheet.
- Observed behavior
- The original macro unintentionally clears checkboxes on every worksheet. Furthermore, simple ActiveSheet commands fail to clear checkboxes that are grouped together into a single shape object.
Ensure your workbook is saved as a Macro-Enabled Workbook (.xlsm) and that the Developer tab is enabled in your ribbon to access the VBA editor.
Use ActiveSheet to Clear Ungrouped Checkboxes
This is the most direct method to clear standard, ungrouped form control checkboxes exclusively on the current worksheet.
By replacing the workbook loop with an ActiveSheet reference, the macro will only target the sheet you are currently viewing. Using error handling ensures the macro doesn't break if no checkboxes exist.
Press Alt + F11 on your keyboard to open the Visual Basic for Applications editor.
Find the module containing the macro assigned to your clear button (e.g., Sub Oval1719_Click()).
Remove the loop that iterates through all worksheets. Replace it with: On Error Resume Next, followed by ActiveSheet.CheckBoxes.Value = False, and then On Error GoTo 0.
Iterate Through Shapes to Clear Grouped Checkboxes
Standard checkbox clearing methods skip checkboxes that are grouped. Use this method if your form controls are grouped together.
Use WPS Spreadsheet to Manage Macros and Form Controls
WPS Office provides robust support for VBA macros and form controls. You can easily create, edit, and run macros to manage checkboxes on your active worksheets just like you do in Excel, but within a highly efficient and lightweight interface.
- 1. Open your macro workbook: Launch WPS Spreadsheet and open your .xlsm file containing the checkboxes.
- 2. Access Developer tools: Click the Developer tab on the top ribbon interface.
- 3. Open the VBA Editor: Click the Macros button or press Alt + F11 to access the built-in VBA editor.
- 4. Edit and run the macro: Input the ActiveSheet checkbox clearing code and run the macro directly from your worksheet.

Frequently Asked Questions
Why doesn't ActiveSheet.CheckBoxes.Value = False work for grouped checkboxes?
When checkboxes are grouped, they are encapsulated within a single Group Shape object. The standard CheckBoxes collection does not traverse inside these groups. You must explicitly loop through the shape groups and target the child items to change their values.
How do I assign this VBA macro to a button or shape?
Right-click the shape or button on your worksheet, select 'Assign Macro' from the context menu, choose your newly created macro (e.g., Oval1719_Click) from the list, and click OK.
Can I clear ActiveX checkboxes using the same VBA code?
No, the CheckBoxes.Value method applies only to Form Control checkboxes. To clear ActiveX checkboxes, you need to loop through OLEObjects on the ActiveSheet and set their Object.Value to False.




