Array limit

confusion123

Active Member
Joined
Jul 27, 2014
Messages
400
I read the contents of some data into an array using:

Code:
Dim MyArray() As Variant

MyArray = Cells(1, 1).CurrentRegion.Value

which usually works, unless the data is too "big", which results in the message:

Code:
Run-time error '7': Out of memory

Does anyone know what the limit is, ie number of rows / cols before I see this message?

Also, how can I get round this?

I'm using Excel 2010 32 bit, so is limited to 4GB of Ram. Would a 64 bit Excel help?

Thanks
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
There isn't a fixed limit - it depends on how much memory you have available. 64bit Excel should help, although I'm always a little surprised if people actually need that much data in the array - do you need all the columns?
 
Upvote 0
There isn't a fixed limit - it depends on how much memory you have available. 64bit Excel should help, although I'm always a little surprised if people actually need that much data in the array - do you need all the columns?

My stakeholders haven't a clue.

At present, my data is 80,000 rows and 300 columns!
 
Upvote 0
But why do you need all of that in an array?
 
Upvote 0
Let's assume the cols are HousePrice, Metric1, Metric2, ..... , Metric299

If one of the requirements were to find those where HousePrice > £1m, I would need to apply a filter to column 1 but also return the results of the remaining columns.

I could use autofilter but it's slow.
 
Upvote 0
You should store the data in a separate file (preferably a database) and query it, rather than loading the whole lot into memory.
 
Upvote 0
Thanks.

I've done that in the past using ADO, grabbing the data either stored as a csv on the network or saved in Access / SQL.
 
Upvote 0
I think you should rearrange your data so you have a metric type in one field rather than separate fields for each metric.
 
Upvote 0
I think you should rearrange your data so you have a metric type in one field rather than separate fields for each metric.

Afraid it's not up to me to change the data.

Also, I've just noticed using ADO to bring back the data, "only" brings back the first 255 fields.

I have 300 fileds and the rest is truncated. Is that true or have I done something wrong?
 
Upvote 0

Forum statistics

Threads
1,206,921
Messages
6,075,577
Members
446,147
Latest member
homedecortips

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