Changing Option Buttons status
I think I'd be more careful with the second one--there may be other
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
Yeah, I forgot to put the TypeOf check in (again<g). Thanks for noticing
that.
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
I did qualify my posting by saying "Assuming we are talking about ALL the
OptionButtons on a worksheet" as it was hard to tell from the OP's posting
what was on the sheet.
--
Rick (MVP - Excel)
|