combo box?

zabiullakhan

Active Member
Joined
Aug 30, 2010
Messages
310
I have 2 combo box and i want to change the input range of the second combo box with refrence to the value in first combo box.

For example

combo box 1 - "animals", "flowers"
combo box 2 - "dog", "cat", "lion", "rose", "lily", "lotus"

if i select "animals" in combo box 1 then combo box 2 should list only "dog", "cat", "lion"

if i select "flowers" in combo box 1 then combo box 2 should list only "rose", "lily", "lotus"

Please help
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
try
Code:
[FONT=Courier New]If ActiveSheet.ComboBox1.Value = "Flower" Then[/FONT]
[FONT=Courier New]ActiveSheet.ComboBox2.ListFillRange = Range("B1:B10") ' flower range[/FONT]
[FONT=Courier New]ElseIf ActiveSheet.ComboBox1.Value = "Fruits" Then[/FONT]
[FONT=Courier New]ActiveSheet.ComboBox2.ListFillRange = Range("A1:A10") 'fruits range[/FONT]
[FONT=Courier New]Else[/FONT]
[FONT=Courier New]End If[/FONT]
 

zabiullakhan

Active Member
Joined
Aug 30, 2010
Messages
310
can you please paste the full function..

and i am using cobobox(from controls) as am not use to working on cobobox(activeX controls).

Please help
 

zabiullakhan

Active Member
Joined
Aug 30, 2010
Messages
310
i have this code to populate ComboBox2 with refrence to ComboBox1, however this ComboBox2 is not geting updated. please help

Code:
Private Sub ComboBox1_Change()
    If ActiveSheet.ComboBox1.Value = "animals" Then
        ActiveSheet.ComboBox2.ListFillRange = Range("Reference!B2:B7")      
    ElseIf ActiveSheet.ComboBox1.Value = "flowers" Then
        ActiveSheet.ComboBox2.ListFillRange = Range("Reference!B8:B14") 
    ElseIf ActiveSheet.ComboBox1.Value = "colors" Then
       ActiveSheet.ComboBox2.ListFillRange = Range("Reference!A14:A15")  
    End If
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,130,342
Messages
5,641,592
Members
417,224
Latest member
llama9207

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
Top