Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find/edit combo box source? Gdareos[_2_] New Users to Excel 3 December 20th 08 12:31 PM
Combo Box Row source problem ranswert Excel Programming 2 March 5th 08 08:33 PM
Combo box Row source Richard Excel Programming 2 June 21st 07 09:19 PM
Combo Source from another file Steve Excel Programming 2 August 5th 06 08:32 PM
Source code for combo box in form shnim1 Excel Discussion (Misc queries) 1 April 14th 06 04:46 AM


All times are GMT +1. The time now is 03:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"