Limit to Number of Cells a Range Variable Can Hold

Jeffrey Mahoney

Well-known Member
Joined
May 31, 2015
Messages
3,078
Office Version
  1. 365
Platform
  1. Windows
I'm finding different answers on the internet. Are the number of cells I can alter at once directly related to the amount of RAM on the computer?

I was trying to use this code, but it gave me an out of memory error on the second line
VBA Code:
Set Rng = Sht.Range(TL, TL.Offset(1000000, 700))
Rng.Value = Rng.Value2

I use this code and it's fine
VBA Code:
Set Rng = Sht.Range(TL, TL.Offset(2000, 200))
Rng.Value = Rng.Value2
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
I have no specific answer, but the documentation for Ranges has descriptions for the ".Count" and ".CountLarge" properties. In the latter, it says:
The CountLarge property is functionally the same as the Count property, except that the Count property will generate an overflow error if the specified range has more than 2,147,483,647 cells (one less than 2,048 columns). The CountLarge property, however, can handle ranges up to the maximum size for a worksheet, which is 17,179,869,184 cells.
So, based on that statement, you should be able to have Ranges which encompass the entire sheet. Though, as you've already stated, machine memory may be the true limiting factor.
 
Upvote 0

Forum statistics

Threads
1,221,619
Messages
6,160,876
Members
451,674
Latest member
TJPsmt

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