-
I'm trying to write a VBA macro which consists of a UserForm with a dropdown menu. In one tab I have a list of items that I want to dynamically fill the combobox with. Does anyone know how to do this? For example, in a sheet 1 I have the following items in column A: apple, pears, oranges, and grapes. Basically, when the userform pops up I want the combobox to consists of the apples, pears, oranges and grapes. This list in column A is always growing and I want the combobox to be populated with items from column A. If anyone can help I would greatly appreciated. Thank you!
Marci
-
Here is one way I sometimes use:
Code:
Private Sub UserForm_Activate()
Dim i As Integer
i = 1
Do While IsEmpty(Worksheets("Sheet1").Range("A" & i).Value) = False
ComboBox1.AddItem Worksheets("Sheet1").Range("A" & i).Value
i = i + 1
Loop
End Sub
Let me know if you need anything else.