Is there a #rows limit to pasting an Array to a Range?

Repush

Board Regular
Joined
Sep 21, 2015
Messages
133
Office Version
  1. 365
Platform
  1. Windows
Hi, All.

I am processing some data (1 year, 5 min. average, so 105120 rows) of several data-items.
Col A: Time
Col B: data
Col C: data
. . .

First the values are stored in 1-D arrays, then some data cleaning is done, then each array is pasted to an Excel-sheet.
ArrPI: Variant/Variant(1 to 105120, 1 to 3)
ArrTime: Variant/Variant(1 to 105120)
ArrVal: Variant/Variant(1 to 105120)
Code snippet:
Code:
Sub Get_Data()
    Dim ArrPI As Variant
    Dim ArrTime As Variant, ArrVal As Variant
    ' preprocessing
    ' .
    ' .
    ArrPI = Application.Run( . . . .) 'results in a 2D array
    ArrTime = CleanArray(GetArrayCol(ArrPI, 1)) ' "Column" 1
    ArrVal = CleanArray(GetArrayCol(ArrPI, 2))  ' "Column" 2
    ' result: all rows contain valid data
    nRows = UBound(ArrTime)
    ' Paste each Data colummn to Range
    Data.Resize(nRows, 1) = Application.Transpose(ArrTime)
    Data.Offset(0, 1).Resize(nRows, 1) = Application.Transpose(ArrVal)
    ' And so on . . .
End Sub
A month's data is no problem, but when the number of rows reaches 39584 only #N/A's appear.
My workaround now is:
Code:
    Dim i As Long
    For i = 1 To UBound(Arr)
        MyRange.Offset(i - 1, 0) = Arr(i)
    Next i
Q: is there a #rows limit to pasting an Array to a Range?
I prefer pasting in one go . .
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
There is no limit to posting an array to a sheet, the limit is in the Transpose function.
Various options
1) clean the ArrPI and leave it as a 2d array, then post that to the sheet.
2) loop through the two 1d arrays to create a 2d array
3) Use your current workround.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,184
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top