Tom’s Tutorials For Excel: Deselecting All Embedded OptionButtons and CheckBoxes
If you have embedded OptionButtons or CheckBoxes onto your worksheet from the ActiveX Toolbox or the Forms toolbar, here are two macros for examples of how to deselect those controls. Notice how simple the Forms controls are to manipulate…no looping needed, just a reference to their parent worksheet object.
Deselect all ActiveX OptionButtons and CheckBoxes on the worksheet.
Sub ClearOptionButtonsActiveX() Dim oleObj as Object For Each oleObj in ActiveSheet.OleObjects If TypeOf oleObj.Object is MSforms.OptionButton Then _ oleObj.Object.Value = False If TypeOf oleObj.Object is MSforms.CheckBox Then _ oleObj.Object.Value = False Next oleObj Set oleObj = Nothing End Sub
Deselect all Forms OptionButtons and CheckBoxes on the worksheet.
Sub ClearOptionButtonsForms() ActiveSheet.OptionButtons.Value = xlOff ActiveSheet.CheckBoxes.Value = xlOff End Sub
Dear Tom, Great codes.
What else do OleObjects include, apart from MSforms objects (like OptionButton, CheckBox & similar other ActiveX or the Form controls)?
You can search for that kind of thing and also use the Object Browser, here is a start.
https://www.oorexx.org/docs/winextensions/x3675.htm