Enabling/Disabling multiple option buttons
Maybe
Sub Switch_Em()
Dim ws As Worksheet
Dim obj As OLEObject
Set ws = Sheets("Sheet1")
For Each obj In ws.OLEObjects
If TypeName(obj.Object) = "OptionButton" Then
obj.Object.Value = False
End If
Next obj
End Sub
Mike
"Will" wrote:
I have an excel worksheet ("Sheet 1") with a number of Optionbuttons
all of which I want to disable
via macro which runs from another worksheet ("Sheet 2").
So I want to do something like this:
For i = 1 To 7
Sheets("Sheet 1").Controls("OptionButton" & i).Enable = False
Next i
Will this work?
Or am I missing something?
|