Toggle a Check Mark with a Double-Click in Excel VBA
Question details
Toggle a check mark on and off by double-clicking cells in a worksheet column.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet uses a designated range as a list of cells to check or clear.
- Observed behavior
- Double-clicking an empty cell should add a check mark; double-clicking it again should clear it.
Open the workbook in desktop Excel and identify the worksheet and cell range you want to use. The example uses A1:A10 and clears any existing content in a nonempty cell when it is double-clicked.
Use the Worksheet BeforeDoubleClick event
Add worksheet event code to toggle marks only when a cell in the specified range is double-clicked.
In Excel, select Developer > Visual Basic. In the VBA editor's Project Explorer, double-click the worksheet where you want the check marks.
Paste this code into the worksheet's code window: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.CountLarge <> 1 Then Exit Sub If Intersect(Target, Me.Range("A1:A10")) Is Nothing Then Exit Sub Cancel = True If IsEmpty(Target.Value2) Then Target.Value = ChrW(&H2713) Else Target.ClearContents End If End Sub
In the code window, replace A1:A10 with the cells you want to use. Keep the event code in that worksheet's module, not a standard module.
Use File > Save As and choose Excel Macro-Enabled Workbook (.xlsm). Enable macros only if you trust the file, then double-click a cell in the range twice to add and remove the mark.

Work with checklists in WPS Spreadsheets
WPS Office is a free, lightweight Office alternative with a familiar interface and Excel format compatibility for easier migration. You can edit checklist cells in WPS Spreadsheets, but this Excel VBA event may not work in every WPS edition.

Frequently Asked Questions
Why use BeforeDoubleClick instead of SelectionChange?
Worksheet_BeforeDoubleClick runs when you double-click a cell. SelectionChange runs when you select a cell, which could change a mark when you only intended to move around the worksheet.
How do I change which cells can be toggled?
Open the worksheet code through Developer > Visual Basic and replace A1:A10 in Me.Range("A1:A10") with your desired range.
Why does double-clicking no longer open a cell for editing?
The code sets Cancel = True for cells in the specified range to prevent Excel from entering edit mode. Cells outside that range retain their normal double-click behavior.
Why must I save the workbook as an XLSM file?
The XLSM format preserves VBA code. Use File > Save As and select Excel Macro-Enabled Workbook; an XLSX file cannot retain the macro.




