ComboBox repopulated based on another combobox

ugbe01

New Member
Joined
Sep 14, 2010
Messages
1
Hi all,

Need some help on this one.
I am doing some work for a retailer that uses a Department, Class and Category hierarchy for their products.
I populate the 1st combobox (cboDept) with a list of departments.

Based on the selection made in this combobox, the 2nd combo box (cboClass) needs to be populated with a list of Classes that only exist for the selected Department.

Based on the selection made in this combobox, the 3rd combo box (cboCategory) needs to be populated with a list of Categories that only exist for the selected Department/Class combination.

I have a master list of all Dept/Class/category combinations, and use a macro to create a ranged name for each of Class and Category based upon the results in the combo box.

The macro basically does a if department code = selected department code (cboDept), then list that class item.

The problem is, when to run the macro. Ie what event needs to fire on the combobox to run the macro ?

I cant use OnChange as after I type in the 1st character of the department, the macro will try to run. I may have. I may have 2 departments "Mens Shoes" and "Mens Clothes", so its not until the 6th character is entered that I would get a unique record.

The user may also type in say the 1st 6 characters and the desired selection is highlighted. Without selecting that item, the user may attempt to select from the drop down list on the following combobox.

Not sure if I should be using LostFocus, GotFocus, or what to control when to run the macro.

Any advice would be most welcome.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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