ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Grouping OptionButtons post-creation (https://www.excelbanter.com/excel-programming/285212-grouping-optionbuttons-post-creation.html)

ed

Grouping OptionButtons post-creation
 
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?

Jake Marx[_3_]

Grouping OptionButtons post-creation
 
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]


Ed wrote:
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?



Bob Phillips[_6_]

Grouping OptionButtons post-creation
 
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)

"Ed" wrote in message
...
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?





All times are GMT +1. The time now is 02:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com