Skip to main content

Kutools for Office — One Suite. Five Tools. Get More Done.

How to uncheck another checkbox when a checkbox is checked in Excel?

Author Siluvia Last modified

In many practical scenarios, such as managing a lengthy purchase list in Excel, you may encounter situations where you want to ensure that only one option can be selected within a specific category or group. For instance, if certain categories exceed the set budget, you may need to reselect items so that only one remains checked in each group. Manually managing checkboxes in large lists can be inefficient and error-prone, especially as the number of categories grows. To streamline this process and reduce mistakes, you can set up Excel so that checking a new checkbox within a group will automatically uncheck the previously selected one, ensuring only a single selection per category at any time. This article provides a step-by-step guide on how to achieve this, making your workflow more efficient and reliable.


Uncheck another checkbox when a new checkbox is checked with VBA code

To illustrate the process, consider a situation as shown in the video above. You have ten checkboxes labeled CheckBox1 through CheckBox10, organized into three groups representing different purchase categories.

✅ Group structure:

  • Group 1: CheckBox1, CheckBox2, CheckBox3
  • Group 2: CheckBox4, CheckBox5, CheckBox6, CheckBox7
  • Group 3: CheckBox8, CheckBox9, CheckBox10

Within each group, only one checkbox should be selected at a time. When a new checkbox is checked, the others in the same group are automatically unchecked—similar to radio button behavior but using checkboxes.

🧩 Steps to apply the VBA solution:

  1. Open the VBA Editor: Right-click the sheet tab where the checkboxes are placed, then choose View Code.
  2. View Code menu
  3. Paste the following code into the worksheet's code window:
  4. Dim xBol As Boolean
    'Updated by Extendoffice
    
    Private Sub CheckBox1_Change(): SetCheckBoxes "CheckBox1": End Sub
    Private Sub CheckBox2_Change(): SetCheckBoxes "CheckBox2": End Sub
    Private Sub CheckBox3_Change(): SetCheckBoxes "CheckBox3": End Sub
    Private Sub CheckBox4_Change(): SetCheckBoxes "CheckBox4": End Sub
    Private Sub CheckBox5_Change(): SetCheckBoxes "CheckBox5": End Sub
    Private Sub CheckBox6_Click(): SetCheckBoxes "CheckBox6": End Sub
    Private Sub CheckBox7_Click(): SetCheckBoxes "CheckBox7": End Sub
    Private Sub CheckBox8_Click(): SetCheckBoxes "CheckBox8": End Sub
    Private Sub CheckBox9_Click(): SetCheckBoxes "CheckBox9": End Sub
    Private Sub CheckBox10_Click(): SetCheckBoxes "CheckBox10": End Sub
    
    Private Function SetCheckBoxes(mCheckBoxName As String)
        Dim xAllArr, xArrItem
        Dim xI, xJ
        If Not xBol Then Exit Function
        xAllArr = Array("CheckBox1,CheckBox2,CheckBox3", _
                       "CheckBox4,CheckBox5,CheckBox6,CheckBox7", _
                       "CheckBox8,CheckBox9,CheckBox10")
        For xI = LBound(xAllArr) To UBound(xAllArr)
            If InStr(xAllArr(xI), mCheckBoxName) > 0 Then
                xBol = False
                xArrItem = Split(xAllArr(xI), ",")
                For xJ = LBound(xArrItem) To UBound(xArrItem)
                    If xArrItem(xJ) <> mCheckBoxName Then
                        Me.OLEObjects(xArrItem(xJ)).Object.Value = False
                    End If
                Next
            End If
        Next
        xBol = True
    End Function
    
    Private Sub Worksheet_Activate(): xBol = True: End Sub
    Private Sub Worksheet_SelectionChange(ByVal Target As Range): xBol = True: End Sub
  5. Close the VBA Editor (Alt + Q) and return to Excel to test the checkboxes.

📌 Important Notes:

  • Ensure your checkbox Name properties (not labels) exactly match the names in the code.
  • Groupings are defined in the array line:
    xAllArr = Array("CheckBox1,CheckBox2,CheckBox3", "CheckBox4,CheckBox5,CheckBox6,CheckBox7", "CheckBox8,CheckBox9,CheckBox10")
  • This VBA only works with ActiveX Control checkboxes, not Form Controls.
  • Macros must be enabled for this automation to function.

📺 Demo:

🔍 Troubleshooting Tips:

  • Verify no duplicate checkbox names.
  • Ensure all checkboxes are ActiveX Controls.
  • Each checkbox procedure must correctly call SetCheckBoxes.
  • Cross-sheet scenarios require adaptation via class modules or centralized control.

💡 Alternative Solution: You can use Option Buttons from Form Controls for built-in single selection behavior. However, for advanced layouts and logic control, VBA + Checkboxes is more flexible.

✨ Tip: Tools like Kutools for Excel offer GUI-based checkbox management for easier setup without coding.


Demo: Uncheck another checkbox when a checkbox is checked in Excel

 
Kutools for Excel: Over 300 handy tools at your fingertips! Enjoy permanently free AI features! Download Now!

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

Excel Word Outlook Tabs PowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in