Selecting only one combobox

Jaz05

New Member
Joined
May 11, 2005
Messages
37
Hi,

I have a user form in which I want the user to have ONE of two choices ...
ComboBox1 = choice of Round
OR
Combobox2 = choice of Club

If they choose from the rowsource of ComboBox1 (Round) then ComboBox2 (Club) is disabled.

If they choose from the rowsource of ComboBox2 (Club) then ComboBox1 (Round) is disabled.

If they choose Combobox1 AND Combobox2 then the last choice they made, clears the previous data.

When they choose OK, then depending on which choice the user made, will depend where the form takes them ... to sheet Round or sheet Club


I'm feeling like a 40-year-old VBA Virgin.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
What I would do is add a couple of OptionButtons with the ComboBoxws alongside them. Sample code:

Code:
Private Sub UserForm_Initialize()
    OptionButton1.Value = True
End Sub

Private Sub OptionButton1_Click()
    ComboBox1.Visible = True
    ComboBox2.Visible = False
End Sub

Private Sub OptionButton2_Click()
    ComboBox1.Visible = False
    ComboBox2.Visible = True
End Sub

Private Sub CommandButton1_Click()
    If OptionButton1.Value = True Then
        MsgBox "ComboBox1 to be used"
    ElseIf OptionButton2.Value = True Then
        MsgBox "ComboBox2 to be used"
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,850
Members
449,051
Latest member
excelquestion515

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