DCat1223
9 years agoFrequent Contributor
Filter UserForm ComboBox based on previous ComboBox selection
Hi… I have question regarding the use of ComboBoxes on a UserForm in a Keyword test. I have a “Department” ComboBox that is populated with the following… “Dariy”, “Frozen”, “Grocery”…etc. I would ...
- 9 years ago
Add the Clear method at the beginning of the OnChange event handler to clear the list of Warehouse combobox. Here is my code:
function UserForm1_cxComboBox2_OnChange(Sender) { UserForms.UserForm1.cxComboBox1.Properties.Items.Clear(); if (UserForms.UserForm1.cxComboBox2.Text == "Frozen") { with (UserForms.UserForm1.cxComboBox1.Properties.Items) { Add("100-Warehouse 100"); Add("200-Warehouse 200"); } } if (UserForms.UserForm1.cxComboBox2.Text == "Dairy") { with (UserForms.UserForm1.cxComboBox1.Properties.Items) { Add("110-Warehouse 110"); Add("210-Warehouse 210"); } } }
Does it help?