View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default What is the fastest way to copy a range to a 2D array?

arr is a variant array, which the OP didn't want. If you try to declare
arr() as anything but a variant, you get a type mismatch error in
arr = r.Value

To the OP: Why don't you want a variant array? They are the fastest way to
get data from a worksheet into VBA. If you need a typed array, you could use
a variant array to get the data, then transfer the data into your typed
array, and this would be much faster than looping cell by cell to populate a
typed array. I'm not sure if using the typed array makes much difference if
you have to process it into the typed array before using the typed data.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


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