Wednesday, October 19, 2022

Tutorial - Link Checkboxes To Multiple Cells In Excel

 Tutorial - How To Link Checkboxes To Multiple Cells In Excel


*To Add Checkboxs Under Multiple Range Click Here*


If there are thousands checkboxes need to be linked to other cells, you can apply the following VBA code, and to apply code follow the below step.


1. Go to your worksheet and create checkboxes.

2. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window or you can click on Developer tab ➡ Visual Basic.


3. Click Insert > Module


4. Double click on module1 and paste the below code in the Module Window (make sure module window is clear)
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,now all the 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.


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.

 

To Learn How To Add Multiple Checkbox Check Below Video:









2 comments:

  1. Dear sirs, if someone wants and a second collumn of checkboxes , could you please add that to the above macro ? thank you for your time to free us from hours of needless work!!

    ReplyDelete
  2. Here you go please check latesh upload

    https://excelmindd.blogspot.com/2024/02/tutorial-how-to-link-multiple.html

    ReplyDelete

How To Use Vlookup In Merged Cells

  How To Use Vlookup In Merged Cells Click Here to download sample file for practice Note: Download the file and open with microsoft excel