ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   range to VBA array, and doing this fast (https://www.excelbanter.com/excel-programming/309690-range-vba-array-doing-fast.html)

Erich Neuwirth

range to VBA array, and doing this fast
 
I need to transfer data from a large range to an array
dimmed as double.
Assigning a range to an array dimmed as variant works,
but I am transferring this array to a COM server and
for that transfer I need it as an array dimmed double, not as variant.
Is there a fast way of converting the variant array
to a double array without looping through all the cells?
Or is there another way of getting a range into a double
array fast?

Bob Umlas, Excel MVP[_3_]

range to VBA array, and doing this fast
 
You can make it still VERY fast by something like this:
Sub PossibleSolution()
Dim x As Variant, y(44, 7) As Double
x = Range("A1:G44")
For i = 1 To 44
For j = 1 To 6
y(i, j) = x(i, j)
Next
Next
End Sub


"Erich Neuwirth" wrote:

I need to transfer data from a large range to an array
dimmed as double.
Assigning a range to an array dimmed as variant works,
but I am transferring this array to a COM server and
for that transfer I need it as an array dimmed double, not as variant.
Is there a fast way of converting the variant array
to a double array without looping through all the cells?
Or is there another way of getting a range into a double
array fast?



All times are GMT +1. The time now is 07:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com