View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban Alan Beban is offline
external usenet poster
 
Posts: 200
Default Quickest Way of making an Array

The first array below will be a "vertical" array; the second a
"horizontal" array.

If the functions in the freely downloadable file at
http://home.pacbell.net/beban are available to your file, you can
produce a two-dimensional "horizontal" array with

v = ArrayTranspose(Range("A1:A6"))

Alan Beban

Tom Ogilvy wrote:
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