Excel UserForm Checkbox: Add, Code, and Troubleshoot

VBA & macros · Updated November 14, 2026

An Excel UserForm checkbox is a clickable VBA control that lets someone choose a yes-or-no option in a custom form. In Microsoft Excel for Microsoft 365 on Windows, add one from the Visual Basic Editor’s Toolbox, then read its Value property in VBA to decide what the form should do.

What a UserForm checkbox does

A UserForm is a custom dialog window built with Excel’s Visual Basic for Applications (VBA) tools. A checkbox on that form represents a setting or choice that can be on or off, such as “Include archived items” or “Send me updates.” The control displays a small box and a caption; clicking it changes its checked state.

In VBA, the control is a Microsoft Forms checkbox, commonly called an MSForms.CheckBox. Its Value property holds the state: True means checked and False means unchecked. A checkbox is different from a text box, which accepts typed content, and from an option button, which is generally used to choose one item from a group of mutually exclusive options.

A UserForm checkbox is also distinct from a checkbox placed directly on a worksheet. A worksheet control may be linked to a cell; a UserForm checkbox does not have a built-in LinkedCell property. Your VBA code must read its value and write the result to a cell or another destination if you want to save the choice.

How the control works

A UserForm has a design-time view and a run-time view. In the Visual Basic Editor, you arrange controls and set their properties. When VBA displays the form, users interact with those controls. Events such as a checkbox click or a command button click let your code respond to what the user does.

Each control has a name used in VBA and a caption shown to the user. For example, a checkbox named chkUpdates might have the caption “Send me product updates.” Code refers to chkUpdates.Value, not to the visible caption. Use a meaningful name so the code remains understandable as a form grows.

By default, a checkbox has two states: checked and unchecked. The optional TripleState property allows a third, indeterminate state, represented in VBA by Null. This can be useful when a setting is mixed or unknown, but it can also complicate code. Leave it off for a straightforward yes-or-no question.

Add a checkbox to a UserForm

  1. Save the workbook as an Excel Macro-Enabled Workbook (.xlsm) if it will contain VBA macros.
  2. Open the Visual Basic Editor. On Windows, press Alt+F11, or select Developer > Visual Basic. If the Developer tab is hidden, enable it through File > Options > Customize Ribbon and select Developer.
  3. In the editor, choose Insert > UserForm. If the Toolbox is not visible, choose View > Toolbox.
  4. Select the CheckBox control in the Toolbox and click or drag on the form to place it.
  5. Open the Properties window, usually with F4. Set (Name) to a code-friendly name such as chkUpdates, and set Caption to the words users should see.
  6. Add a command button if users need to submit or close the form. Give it a clear caption, such as “Save,” and a name such as cmdSave.

On a Mac, the Visual Basic Editor is available in desktop Excel, but keyboard shortcuts and control availability can differ by version. The Mac equivalent of the Windows Alt+F11 shortcut is commonly Option+F11; a keyboard’s Function-key setting may affect it. Excel for the web cannot create or run VBA UserForms, so use desktop Excel for this workflow.

Set useful checkbox properties

The Properties window lets you configure the checkbox without writing code. The most useful properties for a basic form include:

  • (Name): The identifier VBA uses, such as chkIncludeClosed. Names cannot contain spaces.
  • Caption: The explanatory text displayed beside the box. Phrase it so the checked state has an obvious meaning.
  • Value: The initial checked or unchecked state. You can set it in the Properties window or initialize it in code.
  • TripleState: Whether the control can have an indeterminate third state. Keep this set to False unless that third state has a clear purpose.
  • Enabled and Visible: Whether users can interact with the control and whether it appears on the form.

Keep the caption short but specific. “Include inactive records” is clearer than “Inactive,” because the latter does not explain what checking the box will do. For a setting with consequences, describe the checked action rather than relying on users to infer it.

Read the checkbox in VBA

To respond to a checkbox, add an event procedure in the form’s code module. Double-clicking the control in the form designer opens an event procedure, or select the checkbox and its Click event from the code window’s drop-down lists. A common design is to let the user make choices and then read them when they click Save.

This example assumes a UserForm named frmPreferences, containing a checkbox named chkUpdates and a command button named cmdSave. It displays a message based on the checkbox’s state:

Private Sub cmdSave_Click()
    Dim wantsUpdates As Boolean

    ' Read the user's choice when Save is clicked.
    wantsUpdates = (Me.chkUpdates.Value = True)

    If wantsUpdates Then
        MsgBox "Updates are enabled."
    Else
        MsgBox "Updates are not enabled."
    End If

    Unload Me
End Sub

The comparison with True makes the intended yes-or-no interpretation explicit. If TripleState is enabled, a checkbox might instead contain Null; code that assumes only True and False needs to account for that possibility. For ordinary preference forms, two-state checkboxes are simpler.

Open the form and store a choice

To show a form from a macro, put a public procedure in a standard module. This example assumes the form is named frmPreferences:

Public Sub ShowPreferences()
    Dim frm As frmPreferences

    ' Create and display a fresh copy of the form.
    Set frm = New frmPreferences
    frm.Show
End Sub

To save the choice, your form’s button event can write it to a worksheet. For example, assume the destination sheet is named Settings and cell B2 will hold the Boolean value. Add this logic to the Save button event in place of the message-only example:

Private Sub cmdSave_Click()
    Dim wantsUpdates As Boolean

    ' Copy the checkbox state to the settings cell.
    wantsUpdates = (Me.chkUpdates.Value = True)
    ThisWorkbook.Worksheets("Settings").Range("B2").Value = wantsUpdates

    Unload Me
End Sub

The cell will contain the Boolean value TRUE or FALSE, which other VBA procedures can read. If the workbook might be renamed or the destination is not the workbook containing the code, consider carefully whether ThisWorkbook or ActiveWorkbook is appropriate. They are not interchangeable: ThisWorkbook means the workbook where the macro code is stored.

To load a saved choice when the form opens, put initialization code in the form’s UserForm_Initialize event. Assuming the same sheet and cell, the form can set its checkbox from that stored value. If the cell might be blank or contain unexpected text, validate it before assigning it; a robust form should not treat arbitrary worksheet content as a guaranteed Boolean.

Choosing captions and designing the form

Use a checkbox when each choice can be independently switched on or off. If a form asks whether to include a tax column and whether to show notes, both boxes can be checked. If a user must choose exactly one delivery method, use option buttons in a group or a drop-down list instead: separate checkboxes would allow contradictory combinations.

Consider these design details before adding several controls:

  • Make the label describe the checked action. “Attach a summary” is more informative than “Summary.”
  • Set sensible defaults. A choice with privacy, cost, or data-removal consequences should not be preselected without a clear reason.
  • Group related choices with a frame or clear visual spacing so users understand which options belong together.
  • Test the form at the size and display scaling used by its intended audience. Long captions may be clipped if the control is too narrow.
  • Provide a clear way to cancel or close the form, and distinguish cancelling from saving when that distinction matters.

Checkboxes can be easier to scan than a collection of yes/no prompts, but a long list makes a form harder to use. If an option needs substantial explanation, add a clear label or help text rather than packing the entire explanation into the checkbox caption.

Common problems and fixes

  • The checkbox is missing from the Toolbox: Make sure a UserForm is selected in the editor and that the Toolbox is open through View > Toolbox. The worksheet controls on Excel’s Developer tab are a different set of tools.
  • “Variable not defined” or “Method or data member not found” appears: Check the control’s (Name) property and make sure the code uses that exact name. A caption is not a control name.
  • The form opens but a click does nothing: Check that the procedure is in the UserForm’s code module and that its event name matches the control, such as cmdSave_Click. Also confirm the button has the expected (Name).
  • The choice does not remain selected next time: A UserForm control does not automatically persist its value. Write it to a cell, a defined storage location, or another suitable destination, then load it when the form initializes.
  • The macro will not run: Confirm the file is saved as .xlsm, macros are permitted by the organization’s security policy, and the workbook is opened in desktop Excel. Do not enable macros in an untrusted file just to use its form.
  • The checkbox shows an unexpected third state: Check the TripleState property and whether code assigns a Null value. Turn off the third state if the form is meant to offer only checked and unchecked.

Macro safety and platform limits

A UserForm is part of VBA, so it is not a no-code feature. Review the workbook’s macros before running them, especially if the file came from someone you do not trust. A checkbox itself is not a security boundary: code must still validate input and enforce any important rules when the user submits the form.

Save a copy of the workbook before running a macro that changes data. VBA actions generally cannot be reversed with Ctrl+Z, so an accidental write or deletion may not be recoverable through Excel’s Undo command. The Mac version of desktop Excel supports VBA, but some control behavior and editor details differ from Windows; verify a form on each platform where it will be used. Excel for the web does not run VBA macros or UserForms.

Frequently Asked Questions

How do I insert a checkbox in an Excel UserForm?

Open the Visual Basic Editor, choose Insert > UserForm, open View > Toolbox, and select CheckBox. Click or drag on the form to place it, then set its (Name) and Caption in the Properties window.

How do I check whether a UserForm checkbox is selected?

Read the control’s Value property in VBA. For a checkbox named chkUpdates, chkUpdates.Value is True when selected and False when cleared, provided the third state is not being used.

Can a UserForm checkbox write directly to a cell?

Not by setting a LinkedCell property; UserForm checkboxes do not have the worksheet control’s linked-cell behavior. Write the checkbox’s Value to a worksheet cell in VBA, usually when the user clicks a Save or Submit button.

Why does my checkbox value disappear after I close the form?

The control’s value belongs to the form instance and is not automatically saved as a workbook preference. Store it somewhere persistent, such as a worksheet cell, and set the checkbox from that saved value when the form is initialized.

Do Excel UserForm checkboxes work in Excel for the web?

No. Excel for the web does not run VBA macros or display VBA UserForms. Use desktop Excel to run a workbook that relies on this kind of form; desktop Mac support can differ from Windows, so test the controls on the target platform.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.