View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark Mark is offline
external usenet poster
 
Posts: 989
Default Comparing against values in a combobox??

I have set an initial item to a combo box. I am now trying to go through an
array to see if the values of the array are already in the combobox. If the
value is not part of the combo box, I want it to be added. Otherwise, I want
the next array value to be checked.

What is the correct syntax for addressing the combobox values?

' Establish array range
For i = 1 To count
iArray(i) = rng.Cells(i).Value
Next i

' Estabish initial member of combobox
Set box1 = UserForm1.ComboBox1
box1.Clear
box1.AddItem iArray(1)

' Compare values
For i = 1 To count
If iArray(i) < item.box1.Value Then
box1.AddItem iArray(i)

End If
Next i