Skip to main content
 

How to link checkboxes to multiple cells in Excel?

Author: Xiaoyang Last Modified: 2022-07-07

Link the checkboxes to multiple relative cells may help you to quickly and easily do some calculations when you need to sum, count or average only the checked or unchecked cells. But, have you ever tried to link the checkboxes to multiple cells at once in a worksheet?

Link checkboxes to multiple cells with formula one by one

Link checkboxes to multiple cells at once with VBA code


arrow blue right bubble Link checkboxes to multiple cells with formula one by one

To link the checkbox to a specific cell, in fact, you can apply a simple formula to link them manually.

1. After inserting the checkboxes in your worksheet, to select the checkbox, please press Ctrl key and then click the first checkbox that you want to link to other cell.

2. Then in the formula bar, type the equal sign =, and then click one cell that you want to link the checkbox to, B2 for example, see screenshot:

doc-link-multiple-checkboxes-1

3. And then press Enter key on the keyboard, now, when you check this checkbox, the linked cell will display TRUE, if uncheck it, it will display FALSE, see screenshot:

doc-link-multiple-checkboxes-2

4. Repeated the above steps to link other checkboxes one by one.


arrow blue right bubble Link checkboxes to multiple cells at once with VBA code

If there are hundreds and thousands checkboxes need to be linked to other cells, the first method will not work effectively, to link them to multiple cells at once, you can apply the following VBA code. Please do as this:

1. Go to your worksheet with the list of checkboxes.

2. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

3. Click Insert > Module, and paste the following code in the Module Window.

VBA code: link checkboxes to multiple cells at once

Sub LinkChecks()
'Update by Extendoffice
Dim xCB
Dim xCChar
i = 2
xCChar = "B"
For Each xCB In ActiveSheet.CheckBoxes
If xCB.Value = 1 Then
    Cells(i, xCChar).Value = True
Else
    Cells(i, xCChar).Value = False
End If
xCB.LinkedCell = Cells(i, xCChar).Address
i = i + 1
Next xCB
End Sub

4. And then press F5 key to run this code, all checkboxes in the active worksheet have been linked to the cells, when you check the checkbox, its relative cell will display TRUE, if you clear a check box, the linked cell should show FALSE, see screenshot:

doc-link-multiple-checkboxes-3

Note: In the above code, i = 2, the number 2 is the starting row of your checkbox, and the letter B is the column location where you need link the checkboxes to. You can change them to your need.


Related articles:

How to select all checkboxes using a single checkbox in Excel?

How to quickly insert multiple checkboxes in Excel?

How to quickly delete multiple checkboxes in Excel?

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

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!