Filtering Available Options in a Combo Box

bamptons

New Member
Joined
Aug 31, 2006
Messages
3
Is it possible to filter the options available in one combo box, depending on the user's selection in a previous combo box.

For example, in the combo box where the choice is 'General' or 'Special', if they choose 'Special' one of the options in the next combo box, which would have been available if 'General' had been selected, should now be unavailable.

Hope that makes sense!!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Say you have this in the range A1:C3:

List|General|Special
General|Item1|Item3
Special|Item2|Item4

Using Insert|Name|Define name A2:A3 List, B2:B3 General and C2:C3 Special. Set the RowSource of ComboBox1 to List and assign it this code:

Code:
Private Sub ComboBox1_Change()
    ComboBox2.RowSource = Range(ComboBox1.RowSource).Cells(ComboBox1.ListIndex + 1, 1)
    ComboBox2.ListIndex = -1
End Sub

Change the ComboBox references to suit.
 

Forum statistics

Threads
1,137,298
Messages
5,680,684
Members
419,924
Latest member
Dhamodharan992

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