Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50162

filling a combobox with a dynamic list

$
0
0
Hi,

I have a combobox on sheet "selection", and the items I want to list in the combobox is on sheet "list" in a column starting at "A3" and going down. I have the following code for this:

Private Sub ComboBox1_Change()

Dim CategoriesArray
Dim Last
RecipeCategories = Sheets("list").Range("A3:A12")
With ComboBox1
.List = CategoriesArray
.ListIndex = 0
End With

End Sub

Right now, I only have 10 items on the list, so the range is "A3:A12", but I want to let the user be able to add or subtract from the list. How do I make it so that the combobox will update the range accordingly? Also, is there a way to make the combobox update when someone hits the drop-down arrow of the combobox?

Thanks for your help.

Viewing all articles
Browse latest Browse all 50162

Trending Articles