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

Aviles

Board Regular
Joined
Dec 17, 2008
Messages
163
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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,214,897
Messages
6,122,141
Members
449,066
Latest member
Andyg666

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
Back
Top