Combo Box Depend on TextBox Value

Abhishek1988

New Member
Joined
Oct 22, 2018
Messages
27
Hello Everyone,

I have two option button :

London_Click() and Paris_Click()

One text Box :

TextBox1_Change()

One combo box:

DropDown_Change()

Under the Combo box I have below items:

"High London"
"Low London"
"High London 2"
"Low London 2"
"High Paris"
"Low Paris"
"High Paris 2"
"Low Paris 2"



my combo box is depended on the option button with below code. P2:P5 are related to london. P6:P9 are related to Paris

If UserForm1.London.Value = True Then
UserForm1.DropDown.RowSource = "P2:P5"




If UserForm1.Paris.Value = True Then
UserForm1.DropDown.RowSource = "P6:P9"



Now I need further filter on drop down based on textvalue.

If text value is High and London checkbox is checked then it should shows only high london and high london 2
If text value is low and London checkbox is checked then it should shows only low london and low london 2
If text value is High and Paris checkbox is checked then it should shows only high Paris and high Paris 2
If text value is low and Paris checkbox is checked then it should shows only low Paris and low paris 2

also help me where is should put coding..

thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
why not use a second set of option buttons? Put each set in a frame, and you're good.
 
Last edited:
Upvote 0
You may want to use another combo box and have the values as "High", "Low", and ""

The code you want the following code

Code:
Private sub London_Click()

if me.london then
     select case me.comboHIghLow.value

              Case "High"
                     me .DropDown.RowSource = "P4:P5"
             Case "Low"
                     me .DropDown.RowSource = "P2:P3"
             Case else
                     me .DropDown.RowSource = "P2:P5"
     End select

Else

     select case me.comboHIghLow.value

              Case "High"
                     me .DropDown.RowSource = "P8:P9"
             Case "Low"
                     me .DropDown.RowSource = "P6:P7"
             Case else
                     me .DropDown.RowSource = "P6:P9"
     End select
end if
end sub


Private sub Paris_Click()

if me.london then
     select case me.comboHIghLow.value

              Case "High"
                     me .DropDown.RowSource = "P4:P5"
             Case "Low"
                     me .DropDown.RowSource = "P2:P3"
             Case else
                     me .DropDown.RowSource = "P2:P5"
     End select

Else

     select case me.comboHIghLow.value

              Case "High"
                     me .DropDown.RowSource = "P8:P9"
             Case "Low"
                     me .DropDown.RowSource = "P6:P7"
             Case else
                     me .DropDown.RowSource = "P6:P9"
     End select
End if
end sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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