I am stuck on this one...
How do I cut this code down by using a variable instead of harding each combobox's numbers (e.g. 1, 2, 3)?
I wanted to use something like:
but its not working. Any thoughts?
Cheers.
AMAS
How do I cut this code down by using a variable instead of harding each combobox's numbers (e.g. 1, 2, 3)?
Code:
' Populate options on userform
MyArray = Array("Apples", "Bananas", "Grapes", "Oranges")
For Ctr = LBound(MyArray) To UBound(MyArray)
Fruits.ComboBox1.AddItem MyArray(Ctr)
Fruits.ComboBox2.AddItem MyArray(Ctr)
Fruits.ComboBox3.AddItem MyArray(Ctr)
Next
I wanted to use something like:
Code:
For n = 1 to 3
Fruits.ComboBox(n).AddItem MyArray(Ctr)
Next n
but its not working. Any thoughts?
Cheers.
AMAS