My code creates over ~40 different arrays across many subroutines, each one being 1-dimensional using the best datatype for memory.
Dim N As Long
N = 40000
Dim my_array() As Double
ReDim my_array(1 To N)
Dim i as Long
For i = 1 to N
my_array(i) = Rnd
Next i
In most cases, the process runs at ~ 40,000 rows, and I can write to worksheets fine using transpose
rng.Resize(N, 1).Value = Application.Worksheet.Transpose(my_array)
But now that I am have scenarios over ~ 65k rows, up to 200,000 in some cases, I’ve been noticing #N/As when printed to the sheet (as opposed to the documented Transpose array problem type mismatch for certain Excel Versions).
I would like to be able to optimally get the arrays onto the sheet and avoid losing information.
Ideas I have thought about:
Do I reloop all variables into a 2d variant arrays so I can write directly without transpose? This may drastically increase my memory usage.
Do I break my transposes programmatically into sectioned loops that fit the ~65k size limit? This seems cumbersome but interesting.
And then should I write a function to do either and employ it to each array or wrap all arrays into the process at the same time within the general subroutine?
Any thoughts of what I should do or code examples that have been useful to you for this issue? Thanks