Reading a Range to an Array
Hi, Tom Ogilvy posted a similar example to what you are trying to do:
Dim vArr as Variant
vArr = Range(Cells(1,1),Cells(1,1).end(xldown))
for i = lbound(varr,1) to ubound(varr,1)
debug.print i, varr(i,1)
Next
You must pick up a range as a variant variable, which will then contain
the
array.
The array is always two dimensional, even for a single column.
for a single row it would be
Sub Tester5()
Dim vArr As Variant
vArr = Range(Cells(1, 1), Cells(1, 256).End(xlToLeft))
For i = LBound(vArr, 2) To UBound(vArr, 2)
Debug.Print i, vArr(1, i)
Next
End Sub
HTH--Lonnie M.
|