'Is there a limit to how many cells I can assign to an array? [duplicate]

I am trying to assign all the values from a column to an array using VBA.

Dim all_datapoints() As Variant

With ActiveSheet
    'get number of datapoints in the desired column
    n = .Cells(1, 4).End(xlDown).Row

    'assign column values to array
    all_datapoints = Application.Transpose(.Range(.Cells(1, 4), .Cells(n, 4)))

End With

The value of n is about 240,000 but the array all_datapoints() only contains 42,783 datapoints. I looked over my datasheet and there are no N/A, Error, or missing values in this column (should just be a column of strings). I am not sure why it refuses to get the rest of the data.

Even if I include ReDim all_act_molecules(1 to n) before assigning the range, it limits to only grab the first 42,783 values. Help!

vba


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source