using MS Excel 2007, and VBA I have two combobox.The first combobox has three items as:{One, Tow, Three} now I would like to load the second combobox based on what user select in combobox1. For example if user select One in the from combobox1 then namebox1 will populate to combox2 and if if user select Two in the from combobox2 then namebox2 will populate to combox2 and so on..

Can you please let me know how I can do this in VBA?


Re: VBA How to Populate Combobox2 Based on Previous Combobox1 Selection 80 80

You can try the following -

If combo1.Value = "One" Then
    combo2.AddItem "stuff for one"
Elseif combo1.value = "Two" Then
    combo2.AddItem "stuff for two"
    combo2.AddItem "stuff for three"
End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.