Thiago
Thiago

Reputation: 1565

create Combobox with index - Excel VBA

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!

Upvotes: 1

Views: 3546

Answers (1)

Steve
Steve

Reputation: 1648

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

Upvotes: 3

Related Questions