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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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.
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,521
Members
449,088
Latest member
RandomExceller01

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