View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Adding items to the second column of a list box

One way:

Private Sub UserForm1_Initialize()

Dim myArr1 As Variant
Dim myArr2 As Variant
Dim iCtr As Long

myArr1 = Array("a", "b", "c", "d")
myArr2 = Array("1", "2", "3", "4")

With Me.ListBox1
.ColumnCount = 2
For iCtr = LBound(myArr1) To UBound(myArr1)
.AddItem CStr(myArr1(iCtr))
.List(.ListCount - 1, 1) = myArr2(iCtr)
Next iCtr
End With

End Sub

mika wrote:

Hi,

I am populating from a one dimensional array.

I have two one dimensional arrays, so I want to populate
the first column with values from the 1st array, and the
second coumn with values from the 2nd array.

Thanks,
mika
-----Original Message-----
if you are using the rowsource or listfillrange, just set

the reference to
two columns

Sheet1!A1:B20

Also, set the columncount property to 2

if not, how are you populating the listbox?

--
Regards,
Tom Ogilvy

"mika" wrote in

message
...
Hi,

I have a 2-column list box, but I can't figure out how

to
add items to the second column. Any help would be

greatly
appreciated.

Thanks,
Mika



.


--

Dave Peterson