So I have two comboboxes, Combobox1
and Combobox2
. If the user chooses "Apple" for Combobox1
, I want the values for Combobox2
to be "Sauce" and "Seeds".
Likewise, if a user picks "Blueberry" for Combobox1, i'd like Combobox2 values to choose from be "Pie" and "Cobbler".
I'm having touble figuring out how to make the values for the second combobox based on the first choice. I think it would be something like this...
Private Sub Combobox1_Change()
If Combobox1= Apple Then
Combobox2.AddItem "Sauce"
Combobox2.AddItem "Seeds"
End If
If Combobox1= BlueberryThen
Combobox2.AddItem "Pie"
Combobox2.AddItem "Cobbler"
End If
End Sub
The onChange event is working based on test i've done, but no matter what I pick for the first combobox, the second combobox is empty.
Option Explicit
at the top of each module. It enforces variable declaration and reports undeclared or misspelled variables/constants at compile time. To have this automatically in new modules, set the Require Variable Declaration option in the VBA Editor. – Andre