Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
MyArray (ComboBox.ListCount-1) possible?
"How do I set the total number of elements of an array to match the total
number of items in a ComboBox thanks in advance" |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
MyArray (ComboBox.ListCount-1) possible?
"How do I set the total number of elements of an array to match
the total number of items in a ComboBox Give this a try (where I assumed the ComboBox was named ComboBox1)... Dim X As Long Dim MyArray() As String ReDim MyArray(0 To ComboBox1.ListCount - 1) For X = 0 To ComboBox1.ListCount - 1 MyArray(X) = ComboBox1.List(X) Next Rick |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
MyArray (ComboBox.ListCount-1) possible?
Hi,
You can put the entire combox into an variant array in one shot: ------------------------------------------------------------------------- Private Sub UserForm_Click() Dim i As Long Dim v ''' array ''' put the entire listbox into an array v = Combobox1.List ''' display first column (index 0) For i = LBound(v, 1) To UBound(v, 1) MsgBox v(i, 0) Next End Sub or you can create it yourself: -------------------------------- Private Sub UserForm_Click() dim v() as string ''' size the array redim v ( 0 To Combobox1.Listcount-1) ''' fill the array for i = 0 to Combobox1.Listcount-1 v(i)=Combobox1.List(i) next ''' Display the array For i = LBound(v) To UBound(v) MsgBox v(i) Next -- Regards, Sébastien <http://www.ondemandanalysis.com "LuisE" wrote: "How do I set the total number of elements of an array to match the total number of items in a ComboBox thanks in advance" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
XL 2003: ListBox ListCount (and other) properties missing from Local Variables window | Excel Programming | |||
Dim MyArray() as Long, Dim MyArray() as String, etc. | Excel Programming | |||
Dim MyArray vs. Dim MyArray() | Excel Programming | |||
Can I reset an array to myarray() | Excel Programming | |||
Redim MyArray | Excel Programming |