PC Review


Reply
Thread Tools Rate Thread

Combo Box row Source

 
 
art
Guest
Posts: n/a
 
      19th Oct 2008
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.
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      19th Oct 2008
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.

 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      19th Oct 2008
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
<(E-Mail Removed)> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Row Source in combo box Pete Microsoft Access 3 27th Nov 2007 05:55 PM
Using Row source of combo box Roy Goldhammer Microsoft Access Form Coding 1 23rd Mar 2005 12:24 PM
Changing row source in combo box 'B based on contents of combo box =?Utf-8?B?UGFyaWFo?= Microsoft Access Forms 1 17th Sep 2004 10:25 PM
Combo Box - Confused on Record Source vs Control Source ? ZBC Microsoft Access Forms 2 13th Jan 2004 12:37 AM
Store non-bound combo column as combo's control source? Nick Mirro Microsoft Access Forms 5 1st Sep 2003 03:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:49 PM.