View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy Doug Glancy is offline
external usenet poster
 
Posts: 770
Default Quickest Way of making an Array

Jason,

Slightly different than Dave's. Apparently, without the Transpose, even a
one-dimensional array is treated as multi-dimensional when created from a
range. The Transpose removes the multi-dimensional quality, so the
reference is to v(i) rather than v(i,1):

Sub test()
Dim v As Variant
Dim i As Long

v = Application.Transpose(ActiveSheet.Range("A1:A6"))
For i = LBound(v) To UBound(v)
Debug.Print "v(" & i & ") = " & v(i)
Next i
End Sub

hth,

Doug


"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.