ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combo Box row Source (https://www.excelbanter.com/excel-programming/418723-combo-box-row-source.html)

Art

Combo Box row Source
 
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.

JLGWhiz

Combo Box row Source
 
See the AddItem method in VBA help. Also look at the List method.

"art" wrote:

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.


Chip Pearson

Combo Box row Source
 
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)

On Sun, 19 Oct 2008 11:20:00 -0700, art
wrote:

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.



All times are GMT +1. The time now is 02:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com