POPULATE combobox

S

sunilpatel

I am new with combobox stuff. I have created one but how do you populate
with an array$ using vba. where do you write code?
A small example would be appreciated. Can't find a simple via google.

Thank
 
J

Jacob Skaria

Private Sub CommandButton1_Click()
arrTemp = Array(1, 2, 3, 4, 5)
For intTemp = 0 To UBound(arrTemp)
UserForm1.ComboBox1.AddItem arrTemp(intTemp)
Next
End Sub

If this post helps click Yes
 
D

Dave Peterson

If you already have an array and you're creating a userform, you can use that
userform's initialize procedure.

Option Explicit
Private Sub UserForm_Initialize()

dim myArr as variant
myArr = array("a","b","c") 'or however you determined the array

me.combobox1.list = myArr

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top