Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to link checkboxes to multiple cells in Excel?

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


Quickly insert multiple check boxes in selections ta once:
Kutools for Excel’s Batch Insert Check Boxes utility can help you to quickly insert multiple checkboxes at once. Read more about this feature...
doc-create-combobox22

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 20150310
i = 2
For Each cb In ActiveSheet.CheckBoxes
cb.LinkedCell = Cells(i, "B").Address
i = i + 1
Next cb
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?


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

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!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Eyale · 10 months ago
    How about if you have some empty rows in ColumnA (as per your example) in between checkboxes? Using the above code it gets the linked cells wrong if there are empty rows because it does not skip them. Interested to see the solution
    • To post as a guest, your comment is unpublished.
      R · 7 months ago
      Did u find any solution for this? Same problem
  • To post as a guest, your comment is unpublished.
    Richard Anthony · 2 years ago
    Sub LinkCheckBoxes()

    Dim chk As CheckBox

    Dim lCol As Long

    lCol = 1 'number of columns to the right for link



    For Each chk In ActiveSheet.CheckBoxes

    With chk

    .LinkedCell = _

    .TopLeftCell.Offset(0, lCol).Address

    End With

    Next chk



    End Sub
  • To post as a guest, your comment is unpublished.
    Wedzmer Munjilul · 2 years ago
    Hello! Nice post about the VBA...
    but what if there are 3 columns that has checkboxes that needs to be linked in three other columns as well? Let's say columns B, C, and D has checkboxes and should be linked to columns H, I, and J respectively.
    • To post as a guest, your comment is unpublished.
      Paul Forde · 2 years ago
      Hi,

      Having same problem - Have you found out how to get around this?

      Thanks,
      Paul
      • To post as a guest, your comment is unpublished.
        Marcos Grazina · 2 years ago
        Hey,

        Try this:

        Sub LinkCheckBoxes()
        Dim chk As CheckBox
        Dim lCol As Long
        lCol = 2 'number of columns to the right for link

        For Each chk In ActiveSheet.CheckBoxes
        With chk
        .LinkedCell = _
        .TopLeftCell.Offset(0, lCol).Address
        End With
        Next chk

        End Sub



        If you have for example, checkboxes in D,E,F change "Icol" to 1, so it links to G,H and I, respectively.
  • To post as a guest, your comment is unpublished.
    thea · 2 years ago
    Can I do this and program the boxes to say something other than true and false?
  • To post as a guest, your comment is unpublished.
    Louise · 2 years ago
    Hi,

    In your VBA code: link checkboxes to multiple cells at once, the code is set up to link the cell below it. How is the code if I want to link the cell to the left of the first one?

    Thanks!
  • To post as a guest, your comment is unpublished.
    ALi · 3 years ago
    i have more than 40000 cell which have checkbox. when i use this code, it takes more than 5 second to process, i define different macros for different cells but i have still the problem, what can i do?