I have two sets of checkboxes on the same worksheet. Previously, I have used this code to make a box that will select all checkboxes.
But this code does the same thing for all the checkboxes. I need to be able to separate the two sets of checkboxes somehow without having to rename every single checkbox. I tried changing "ActiveSheet" in this line
to a range value. And I tried adding the range after "ActiveSheet" and both of those gave me an error that said this object or method is not supported. Can someone show me how to change these macros so that I can have two sets of checkboxes that each have a checkbox that selects all in that set? Thanks in advance!
Code:
Sub CheckBox8_Click()
Dim CB As CheckBox
For Each CB In ActiveSheet.CheckBoxes
If CB.name <> ActiveSheet.CheckBoxes("Check Box 8").name Then
CB.Value = ActiveSheet.CheckBoxes("Check Box 8").Value
End If
Next CB
End Sub
Sub Mixed_State8()
Dim CB As CheckBox
For Each CB In ActiveSheet.CheckBoxes
If CB.name <> ActiveSheet.CheckBoxes("Check Box 8").name And CB.Value <> ActiveSheet.CheckBoxes("Check Box 8").Value And ActiveSheet.CheckBoxes("Check Box 8").Value <> 2 Then
ActiveSheet.CheckBoxes("Check Box 8").Value = 2
Exit For
Else
ActiveSheet.CheckBoxes("Check Box 8").Value = CB.Value
End If
Next CB
End Sub
Code:
For Each CB In ActiveSheet.CheckBoxes