F
Fan924
I have 3 Option Buttons on a sheet. Can I set the true/false status of
the buttons using a macro from another sheet?
the buttons using a macro from another sheet?
OLEObjects
on that sheet:
Sub ResetActiveXOptionButtons()
Dim OptBtn As OLEObject
For Each OptBtn In Worksheets("Sheet1").OLEObjects
If TypeOf OptBtn.Object Is MSForms.OptionButton Then
OptBtn.Object.Value = False
End If
Next OptBtn
End Sub
And I've seen where lots and lots (much more than the OP's 3) of
optionbuttons
(from the forms toolbar) would cause that first routine to break. Looping
through all of them would work, though:
Dim OptBtn As OptionButton
For Each OptBtn In Worksheets("Sheet1").OptionButtons
OptBtn.Value = xlOff
Next OptBtn
.OptionButton1.Value = False
.OptionButton2.Value = False
.OptionButton3.Value = False
End With