View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default What is the fastest way to copy a range to a 2D array?


Just a heads up:

The OP said:
I do not want a variant array.


I don't know why the OP has this requirement, but with your suggestion:

Sub equiangular()
Dim r As Range
Set r = Range("A1:C13")
ReDim arr(1 To 13, 1 To 3)
arr = r.Value
MsgBox TypeName(arr)
End Sub

produces Variant()

If you give
ReDim arr(1 To 13, 1 To 3) as anything but variant, you get a type mismatch
error

I think you have to loop if the OP doesn't want a variant array.

In all versions of excel, picking up a range from a worksheet in one command
requires a variant and in xl2000 and later, that can also be a variant
array.

--
Regards,
Tom Ogilvy

"Gary''s Student" wrote in message
...
Sub equiangular()
Dim r As Range
Set r = Range("A1:C13")
ReDim arr(1 To 13, 1 To 3)
arr = r.Value
End Sub

is one way
--
Gary's Student
gsnu200705


"equiangular" wrote:

I do not want a variant array.