This is not necessary, though, when populating a multi-column list
from a 2D array...
Dim vData
vData = ActiveSheet.UsedRange
With ListBox1
.ColumnCount = UBound(vData, 2) '//# of cols in the array
.List = vData
End With
..where ListCount will be UBound(vData), but the first item index for
both rows/cols is zero.
Actually, that works with a 1 column/row list so long as you specify
its ColumnCount property. So...
Dim vData
vData = Range("A1:A3")
With ListBox1
.ColumnCount = UBound(vData, 2) '//# of cols in the array
.List = vData
End With
...results
a1
a2
a3
...and...
Dim vData
vData = Range("A1:C1")
With ListBox1
.ColumnCount = UBound(vData, 2) '//# of cols in the array
.List = vData
End With
...results
a1 a2 a3
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion