Link to home
Start Free TrialLog in
Avatar of borris111698
borris111698

asked on

VBA Strings and Arrays

I have an array A(10) which I want to control using a combobox but can not get it to work

for i = 0 to unbound(combobox1,value) .... I need this loop to run when the user select A from the drop down

Cheers
Avatar of mcdown75
mcdown75
Flag of United States of America image

Try this

dim i as integer
For i = 0 to upperbound(A)
    myComboBox.additem(a(i))
Next
myCombo.index = 0

This should loop through your array and add each item to your combo box.
Avatar of borris111698
borris111698

ASKER

Cheers Mcdown but I already have a 2 column dropdown (combobox1) populated from an array Section(), the 1st Column has letters A-N the second a description. When the user selects an item I want to populate a sub 2 column dropdown (combobox2) from the arrays A(5), B(6), C(7), D(8)...... etc

I have been able to this using select case, but thought I could do it more simply by using

for i = 0 to unbound(combobox1.value)

therefore if the user selects B from the first dropdown the second in populated with 7 items from the array..
Avatar of GrahamSkan
Are you saying that the letters A to N are the names of 14 arrays and that you need to populate your second combo with the one whose name is selected in the first combo?
ASKER CERTIFIED SOLUTION
Avatar of mcdown75
mcdown75
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial