Did you try my code? As long as the variable is a variant and you use VALUE
it works. It just doesn't load the array the same way as using the for loops.
"Bernard Liengme" wrote:
No, Joel, you cannot assign a range to an array.
Have a look in VBA Help to verify this statement
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email
"joel" wrote in message
...
Y = Range("A1:J1000").value
"Bill Martin" wrote:
I'm using a large array to pass data to/from a DLL that I call from VBA
and all
works well. I'm just wondering if there's a faster way to fill the
array.
Basically I'm doing something of the form:
redim Y(1000,10) as single
'Now fill the array from the spreadsheet
for I = 1 to 1000
for J = 1 to 10
Y(I,J) = cells(I,J)
next J
next I
Call_DLL(Y())
'And now put the data back into the spreadsheet.
Range("A1:J1000").value = Y()
Using the For/Next loop to fill the array takes a fair amount of time in
my
actual code. Putting the array back into the sheet however is virtually
instantaneous.
So, is there some faster approach I can use than the For/Next loop? I
won't
bother to list out all the things I've tried that I now know *don't'*
work.
I'm using Excel 2003, FWIW...
Thanks.
Bill