View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_3_] Alan Beban[_3_] is offline
external usenet poster
 
Posts: 130
Default Dumping the contents of a VBA array to a sheet

What version are you using? As Tom Ogilvy pointed out, the direct dump
works fine in xl2000. For earlier versions there may be a limit (I don't
have an eearlier version to test). If so, and if that limit is 5461
elements, and if the functions in the downloadable file at
http://home.pacbell.net/beban are available to your workbook, the
following might work on an array referred to by the variable "myArray";
I say "might" out of an abundance of caution--it works in xl2000, and I
expect it works in earlier versions.(Watch for word wrap in this posting.):

Set rng = Range("A1")
k = 1
For i = 1 To 68250 Step 2730
Range(rng(i, 1), rng(Application.Min(65536, 2730 * k), 2)).Value =
SubArray(myArray, 1, 2, i, 2730 * k)
k = k + 1
Next

Alan Beban

Dave wrote:
I've got a VBA array that is 65536 rows by 2 columns (I've truncated it to
fit into two columns) that I'm trying to dump to the A and B columns of a
spreadsheet. I'm getting a Runtime 1004 error a few seconds after the line
of code tries to execute the dump

Presumably I'm trying to dump too much data, if so how do I dump the array
in smaller chunks?

Cheers

Dave