Grouping OptionButtons post-creation

E

Ed

Anyone have any suggestions for how to group option
buttons after I've created/coded them? For example, I
need to group six new option buttons so that when any one
of them is selected, neither of my two other
optionbuttons (in a different group) are deselected?
 
J

Jake Marx

Hi Ed,

Are these OptionButtons on a worksheet? If so, you could do something like
this:

Sub GroupOpts()
Dim n As Integer

For n = 1 To 5
With Sheet1.OLEObjects("OptionButton" _
& CStr(n)).Object
If n <= 3 Then
.GroupName = "grp1"
Else
.GroupName = "grp2"
End If
End With
Next n
End Sub

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
B

Bob Phillips

Ed,

Are they ActiveX Toolbox control?

If, so, get the Control Toolbox toolbar up, and go to design mode (the blue
triangle icon to the left). Then select the optionbutton. Click the
properties icon, the hand pointing to a document next the design icon, and
there is a GroupName property that you can change.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top