Transferring ranges to/from arrays
Dim inargs as Variant
inargs = Range("x").Resize(3,1).Value
' inargs is a 1 to 3, 1 to 1 array (two dimensions)
Range("x").Resize(3,1).Value = outargs
--
Regards,
Tom Ogilvy
Jag Man wrote in message
...
What is the most efficient way to load data from a sheet range into an
array
so I can
pass the data to a DLL function? And, to transfer the results back into
another sheet range?
That is, I want to do something like this
Sub mySub
inargs(0) = Range("x").value
inargs(1) = Range("y").value
inargs(2) = Range("z").value
ec = theDllFunction(inargs(0), outargs(0)
Range("a").Value = outargs(0)
Range("b").Value = outargs(1)
Range("c").Value = outargs(2)
End
The above works, but if the cells named x, y, z, and those named a, b, c,
are in a contiguous ranges it seems there must be
a more efficient way to do this.
TIA
Ed
|