Remove the ", i" (shown in red) and then try it.Not sure what is causing it, thanks.
Code:Private Sub UserForm_Initialize() Dim Arrayb(2) As Variant Arrayb(1) = "test1" Arrayb(2) = test2 For i = 1 To 2 With ComboBox1 .AddItem Arrayb(i)[SIZE=3][B][COLOR=#B22222], i[/COLOR][/B][/SIZE] End With Next i End Sub
Dim Arrayb(2) As Variant
Dim Arrayb(1 to 2) As Variant
Remove the ", i" (shown in red) and then try it.
If you don't specify an index, the next item is placed automatically into the next unfilled line. The index argument is good when you want to address a specific item in the ComboBox (to edit it, for example).That solved it. I thought that would control the order they were in in the combobox? it is called "pvargIndex" so that is why I thought it would be order.
I didn't test it, but the problem may result from the fact that the first indexed item is 0, not 1. I am guessing that when you tried to put something in line #1 when there was nothing in line #0, VB balked.Re:Domenic
I already had option base 1 on, thanks though. I was curious and tried it after commenting it out and it still worked fine (well, still failed in the same way). That probably wouldn't cause the error as long as i'm not calling Lbound(array) or anything that used the first one.