Checkbox select all, but only for a specific group of checkboxes

Aviles

Board Regular
Joined
Dec 17, 2008
Messages
161
Hi all,

I have this code which checks/unchecks all of the checkboxes in my worksheet:

VBA Code:
Sub SelectAll()

    Dim xCheckBox As CheckBox
    For Each xCheckBox In Application.ActiveSheet.CheckBoxes
        If xCheckBox.Name <> Application.ActiveSheet.CheckBoxes("chkMasterB").Name Then
            xCheckBox.Value = Application.ActiveSheet.CheckBoxes("chkMasterB").Value
        End If
    Next

End Sub

However, I have 2 columns with 10 checkboxes in each column and I would like to have 2 separate "select all" checkboxes for each column so they work independent of each other.

So one select all checkbox for all of the checkboxes in column A, and another select all checkbox for all of the checkboxes in column B.

I'm guessing I would have to name each checkbox individually but I'm not sure how to do this.

Thanks for your help.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,141,867
Messages
5,709,086
Members
421,614
Latest member
RAB29

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top