Create and Link Multiple ActiveX Checkboxes in Excel with VBA
Question details
Create and link approximately 150 ActiveX checkboxes without configuring each one individually, and update status and date fields when a checkbox changes.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Each checkbox needs a linked TRUE/FALSE value and corresponding status and date fields on a properties worksheet, with the date also displayed on the checkbox worksheet.
- Observed behavior
- The desired result is a reusable, data-driven setup that handles checkbox changes without a separate procedure for each control.
Use desktop Excel for Windows with ActiveX controls and macros enabled, and save the workbook as an Excel Macro-Enabled Workbook (.xlsm). The example uses sheets named Sheet1 and Properties, rows 2–151, and columns A–B on Sheet1 and B–D on Properties; adjust the names and ranges to fit your layout.
Create linked checkboxes and handle changes with a VBA class
Use one creation macro and a shared class-based event handler to manage checkbox values, statuses, and dates by row.
This example places checkboxes in Sheet1 column A. Each checkbox links to the corresponding Properties column B cell; the handler writes a status to column C, a date to column D, and the same date to Sheet1 column B. Checking sets today's date; unchecking clears both dates.
The handler collection must remain in memory. The Workbook_Open procedure initializes it whenever the workbook opens with macros enabled, and the creation macro initializes it after adding controls.
Press Alt+F11, choose Insert > Class Module, and use the Properties window to name it CheckboxHandler. Paste this code: Public WithEvents Box As MSForms.CheckBox Public RowIndex As Long Private Sub Box_Click() Dim p As Worksheet, s As Worksheet If IsNull(Box.Value) Then Exit Sub Set p = ThisWorkbook.Worksheets("Properties") Set s = ThisWorkbook.Worksheets("Sheet1") If Box.Value = True Then p.Cells(RowIndex, "C").Value = "Complete" p.Cells(RowIndex, "D").Value = Date s.Cells(RowIndex, "B").Value = p.Cells(RowIndex, "D").Value Else p.Cells(RowIndex, "C").Value = "Incomplete" p.Cells(RowIndex, "D").ClearContents s.Cells(RowIndex, "B").ClearContents End If End Sub
In the VBA editor, choose Insert > Module and paste the following code. Change the sheet names, row range, or column references if needed: Public CheckboxHandlers As Collection Public Sub BuildCheckboxes() Dim s As Worksheet, o As OLEObject Dim r As Long Set s = ThisWorkbook.Worksheets("Sheet1") For r = 2 To 151 Set o = Nothing On Error Resume Next Set o = s.OLEObjects("cbItem_" & r) On Error GoTo 0 If o Is Nothing Then Set o = s.OLEObjects.Add(ClassType:="Forms.CheckBox.1", _ Left:=s.Cells(r, "A").Left, Top:=s.Cells(r, "A").Top, _ Width:=s.Cells(r, "A").Width, Height:=s.Cells(r, "A").Height) o.Name = "cbItem_" & r o.Object.Caption = "" o.LinkedCell = "'Properties'!B" & r End If Next r InitializeCheckboxes End Sub Public Sub InitializeCheckboxes() Dim o As OLEObject, h As CheckboxHandler Dim suffix As String Set CheckboxHandlers = New Collection For Each o In ThisWorkbook.Worksheets("Sheet1").OLEObjects If Left$(o.Name, 7) = "cbItem_" Then suffix = Mid$(o.Name, 8) If IsNumeric(suffix) And o.progID = "Forms.CheckBox.1" Then Set h = New CheckboxHandler Set h.Box = o.Object h.RowIndex = CLng(suffix) CheckboxHandlers.Add h End If End If Next o End Sub
In the VBA editor's Project Explorer, double-click ThisWorkbook and add this procedure: Private Sub Workbook_Open() InitializeCheckboxes End Sub If Workbook_Open already exists, add only the InitializeCheckboxes call to the existing procedure.
Return to Excel, press Alt+F8, select BuildCheckboxes, and click Run. On the Developer tab, turn off Design Mode if it is enabled. Check and uncheck a control, then verify the corresponding Properties B–D cells and Sheet1 column B. Format the date columns as dates if necessary.
Work with Excel spreadsheets in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for common Excel formats, making it easy to move everyday spreadsheet work. Use Microsoft Excel for the ActiveX and VBA solution above; do not assume those controls and macros will run in WPS.

Frequently Asked Questions
Why does each checkbox need a unique name?
The example names controls cbItem_2 through cbItem_151. InitializeCheckboxes reads the row number from each name so the shared handler can update the matching row.
What happens to the date when I uncheck a box?
The example changes the status to Incomplete and clears the dates in Properties column D and Sheet1 column B. Edit the Else block in CheckboxHandler if you want to retain the date instead.
Why do the checkboxes stop updating after I reopen the workbook?
The event handlers must be initialized again. Check that ThisWorkbook contains the Workbook_Open call to InitializeCheckboxes and that macros are enabled for the trusted workbook. You can also run InitializeCheckboxes from Alt+F8.
Can I use this ActiveX solution in Excel for Mac or Excel for the web?
No. This example requires desktop Excel for Windows with ActiveX and VBA support. Excel for Mac and Excel for the web do not support this ActiveX setup.
How do I change the target sheets or number of checkboxes?
In the VBA editor, update the worksheet names in both the standard module and CheckboxHandler. Change the For r = 2 To 151 range in BuildCheckboxes, and adjust the cell references and linked-cell formula to match your layout.




