Home » excel » create Combobox with index – Excel VBA

create Combobox with index – Excel VBA

Posted by: admin May 14, 2020 Leave a comment


I know that it’s very simple, but I just can’t find how to do it.

All I wanna do is create a combobox with index!
I’m doing this:

combobox.AddItem "test", 1

but i’m getting errors!
If I don’t put the index, it works!

How can I do it?

Sorry for the stupid question!

How to&Answers:

here is a little bit of code which may help get some understanding of combobox:

Private Sub UserForm_Click()
ComboBox1.AddItem "Col-1 Item-" & ComboBox1.ListCount + 1
ComboBox1.List(ComboBox1.ListCount - 1, 1) = "Col-2 Item-" & ComboBox1.ListCount
End Sub