PC Review


Reply
Thread Tools Rate Thread

ComboBox.List

 
 
Gordon
Guest
Posts: n/a
 
      8th Jun 2007
Trying to load ComboBox from Dynamic Array
Code: Declaration: Option Base 1, Public MyArray()
Procedure: N = 1
ReDim MyArray(N)
MyArray(N) = ActiveCell (and so on)

ReplaceName.Show (UserForm)
Initialize: Me.NameComboBox.List =
MyArray()
(also tried MyArray)

Error: NameComboBox.List...(NameComboBox.List = Null)
Dave Peterson suggested the above, but it doesn't work.

Thank you,
GJ

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      8th Jun 2007
This worked fine for me:

In a general module:
Option Explicit
Public myArray() As String
Sub testme()
Dim iCtr As Long
ReDim myArray(1 To 10)
For iCtr = 1 To 10
myArray(iCtr) = ActiveSheet.Cells(iCtr, "A").Value
Next iCtr
UserForm1.Show
End Sub


Behind the userform:
Option Explicit
Private Sub UserForm_Initialize()
Me.ComboBox1.List = myArray
End Sub

If the equivalent doesn't work for you, you may want to post more details--like
the actual code that fails.

Gordon wrote:
>
> Trying to load ComboBox from Dynamic Array
> Code: Declaration: Option Base 1, Public MyArray()
> Procedure: N = 1
> ReDim MyArray(N)
> MyArray(N) = ActiveCell (and so on)
>
> ReplaceName.Show (UserForm)
> Initialize: Me.NameComboBox.List =
> MyArray()
> (also tried MyArray)
>
> Error: NameComboBox.List...(NameComboBox.List = Null)
> Dave Peterson suggested the above, but it doesn't work.
>
> Thank you,
> GJ


--

Dave Peterson
 
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
Combobox list based on choice in previous combobox Slim Slender Microsoft Excel Programming 0 2nd Aug 2011 11:37 AM
Combobox list based on choice in previous combobox Slim Slender Microsoft Excel Programming 0 2nd Aug 2011 11:16 AM
Limit ComboBox list by previous ComboBox results David Microsoft Access Form Coding 1 7th Aug 2009 07:09 PM
ComboBox list reliant on the entry from a different ComboBox =?Utf-8?B?bmRtIGJlcnJ5?= Microsoft Excel Programming 4 4th Oct 2005 04:40 PM
Values contained in value list of second combobox based on value selected in first combobox. Anthony Microsoft Access Forms 16 6th Mar 2004 04:07 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:46 AM.