Quickest Way of making an Array
Dim v as Variant
v = Range("A1:A6")
will put it in a two dimensional base 1 array (regardless of Option Base
setting)
Dim v as Variant
v = Range("A1:A6")
for i = 1 to 6
msgbox "i" & ", " & v(i,1)
Next
---------
This will put it in a 1 D array:
Sub MakeArray()
Dim v As Variant
v = Application.Transpose(Range("A1:A6"))
For i = 1 To 6
MsgBox "i" & ", " & v(i)
Next
End Sub
--
Regards,
Tom Ogilvy
"WhytheQ" wrote in message
ups.com...
1
2
3
4
5
6
What is the quickest way of putting the above into an array?
The above numbers are located on sheet1 range("A1:A6")
I use what I believe is the normal way of filling the array i.e a For
Next Loop - but maybe there are better ways of going about it?
Regards,
Jason.
|