Select all optionbox within a group on a Userform

MIRA7

New Member
Joined
Dec 19, 2016
Messages
25
Good day all,

I have a optionbox within a group on userform.
I want to create a button if selected by the user, it automatically selects all optionboxes within that group.

Instead of the user selecting each option box individually.


Thank you
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Optionboxes belonging to one group CANNOT be selected simultaneously. Setting one of them to True sets the others to False. Are you sure you don't mean checkboxes?
 
Upvote 0
Thanks Jan.
But you could actually select more than one optionbox if you "groupname" them in their properties, and place them in a frame.
I am able to select multiple optionboxes. However, I want with one button, help the user to select all of them, instead of doing it one by one.
 
Upvote 0
Thanks Jan.
But you could actually select more than one optionbox if you "groupname" them in their properties, and place them in a frame.
I am able to select multiple optionboxes. However, I want with one button, help the user to select all of them, instead of doing it one by one.

As far as I know you can only select one option button. If you select option button 1 then option button 2 is unselected.

Unless you have option buttons in frames. Then you can only select one per frame.

Maybe you could use the Macro Recorder to do this and see how it works.
 
Upvote 0
As far as I know adding a groupname for the option buttons or putting them in a frame should make the option buttons mutually exclusive, i.e. you can only select one at a time.
 
Upvote 0
I figured it out :)
Thank you all for your responses.

Here is the code if anyone needs it later.
Basically, you put all your optionbutton in a frame, and what the code below is doing, it selects all those optionbuttons if the user click on "Select All" commandbutton.
You have to make sure that you groupname those optionbutton in your properties to be able to select multiple ones.

Code:
Private Sub CommandButton4_Click()
 For Each ctrl In Me.Other.Controls
        Select Case TypeName(ctrl)
            Case "ComboBox"
                    ctrl.ListIndex = -1
            Case "OptionButton", "CheckBox"
                    ctrl.Value = True
        End Select
    Next
End Sub
 
Upvote 0
Any chance you could upload a workbook to a file sharing site so we can see how this works?

PS Why would you use option buttons which, are really kind of meant to be mutually exclusive by design, for whatever you are trying to do?
 
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,102
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top