Combo Box Value depend on checkbox and TextBox - USERFORM

Rahulwork

Active Member
Joined
Jun 9, 2013
Messages
284
Hello Everyone,

I have a userform in which i made two combo box, below are the name's

ComFruits_Change()

ComVeg_Change()

Both combo box having informations like below:

Private Sub UserForm_Initialize()

ComFruits.AddItem "Apple 1"
ComFruits.AddItem "Apple 2 "
ComFruits.AddItem "Orange 1"
ComFruits.AddItem "Orange 2"
ComVeg.AddItem "Tomato 1"
ComVeg.AddItem "Tomato 2"
ComVeg.AddItem "Potato 1"
ComVeg.AddItem "Potato 2""



Now i have two check boxes, below are the name's

Private Sub Fruit_Click()


End Sub

Private Sub Vegetable_Click()


End Sub


and last i have one text box, below is the name:

Private Sub txtABC_Change()


End Sub



Now i want if Fruit checkbox is checked then ComFruits_Change() , should be active and other one should be inactive, same with if Vegetable checkbox is checked then ComFruits_Change() should be inactive and other one should be active.

then if txtABC value is apple then under ComFruits_Change(), apple 1 and apple 2 value should reflect, same if value is orange then ComFruits_Change(), orange 1 and orange 2 should reflect.


Please help me with the same. i tried but couldn't happn
 
Re: USERFORM Combo box

Hi, thanks for your response.

I think by mistake you mentioned combo box name on place of checkbox name and vise versa,

by below, i am still able to open both the combo box :(

Private Sub ComFruits_Click()
Call Fruit_Change
End Sub

Private Sub ComVeg_Click()
Call Fruit_Change
End Sub
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Re: USERFORM Combo box

I don't know what you mean by "open both the combo box"
That code will allow you to select from either box at any time. But which combobox controls what is shown in the text box is determined by which option button is checked.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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