Reputation: 75
I have a screen with about 500 checkboxes on it. The first checkbox has to be able to uncheck/check all the others, which my current code does.
I'd like to know if I can make it any faster/instant. Because I'm currently using a For loop it takes a while before it is done.
This is my code:
Dim xCheckBox As CheckBox
For Each xCheckBox In Application.ActiveSheet.CheckBoxes
If xCheckBox.Name <> Application.ActiveSheet.CheckBoxes("ToggleCheck").Name Then
xCheckBox.Value = Application.ActiveSheet.CheckBoxes("ToggleCheck").Value
End If
Next
Upvotes: 3
Views: 272
Reputation: 34075
You can just set them all at once:
ActiveSheet.CheckBoxes.Value = ActiveSheet.CheckBoxes("ToggleCheck").Value
Upvotes: 12