I want to populate a combobox on a userform with a list of 200 numbers (or a variable) that are in sequence without reading or storing them in a worksheet. I would rather not use the split method in VBA and having to enter all 200 numbers in the code. Then maximum number can have four variations and while I can create four split-type array lists and use them according to other user selections, I keep thinking an an array can handle this task with a few lines of code. I did find code online that almost does the trick, except that it creates blank rows as it iterates to the maximum value of 200 instead of the actual number values:
For i = 0 To 200
Userform1.Combobox1.AddItem Cells(i + 1, 1).Value
Next i
With Userform1
.Combobox1.BoundColumn = 0
.Combobox1.ListIndex = 0
.Show
End With
I've tried manipulating the .additem statement and searching the forum for an answer without success. It seems that most lists use either data from the worksheet or an external application.
Your help is appreciated!
Bookmarks