Combo Box row Source

A

art

I want to add a combo box on a userform and want to give a list for the combo
box. How can I achieve that with out actually refering it to a list in a
sheet. Is it possible to write the list in the vba code fro the combo box
list?

Thanks.
 
C

Chip Pearson

There are any number of ways to load the list of a combo box. Here are
three:

Dim Arr() As String
Dim N As Long
ReDim Arr(1 To 10)
For N = 1 To 10
Arr(N) = "Item" & CStr(N)
Next N
UserForm1.ComboBox1.List = Arr
' OR
Dim V As Variant
V = Array("One", "Two", "Three")
UserForm1.ComboBox1.List = V
' OR
For N = 1 To 10
UserForm1.ComboBox1.AddItem "Item" & CStr(N)
Next N

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

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