kittronald expressed precisely :
Is this the shortest way to test if a Checkbox is already checked ?
Sub TEST()
If Sheet2.CheckBoxes("Check Box 23").Value = False Then
Sheet2.CheckBoxes("Check Box 23").Value = True
Else
Sheet2.CheckBoxes("Check Box 23").Value = True
End If
End Sub
- Ronald K.
No need to make the If evaluation redundant, it just adds extra
processing for VBA. No big deal on one-by-one basis but the cummulative
effect can add up...
Sub TEST()
If Not Sheet2.CheckBox23 Then Sheet2.CheckBox23 = True
End Sub
...so if it's NOT True then it gets changed to True. No need to set it
to True if it's already True! No need to test if its value = False
because Value is its default property. IOW, the control can only be
True (checked) or False (unchecked).