Is there a limit to array/variant?

mailcmc282

New Member
Joined
Jun 27, 2011
Messages
1
Hi,

I have code that is supposed to call the first column in an array, then the second, etc. It works unless the length of the array is > 80,000 (or approx that value). Is there a limit to how large the column length in an array can be? :confused: I cannot find anything online about this. If this is the case any help would be appreciate.

dim output_dta () as double
dim statrangeds_ as variant

statsrangeds_ = Application.Index(output_dta, 0, i)

Thank,
CMC
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi CMC and Welcome,

The limitation you are hitting isn't with the Array size or Variant type,
rather it is a limitation of Application.Index()

I encountered a similar problem a few months ago trying to apply Application.Min() to a large range.

Through trial and error I found that it would generate an error when the range had more than 65,536 rows.

That is also the maximum number of Rows in a worksheet prior to xl2007 which probably isn't a coincidence.

A simpler way to accomplish your intent that doesn't have this limitation is to replace:
Code:
statsrangeds_ = Application.Index(output_dta, 0, i)

With this...
Code:
statsrangeds_ = output_dta(0, i)

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,733
Members
452,939
Latest member
WCrawford

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