General Efficient Read In of Static Data

thegoat001

New Member
Joined
Jan 21, 2018
Messages
1
Hi All,

I have a large amount of static data i.e. it will never need to be changed.

It's 146,000 rows by 20 columns.

What I typically do is use a macro to read data in from a sheet cell by cell and then store it into an array. Saving the data this way seems to be pretty time consuming. Turning off the screen refresh does help though.

From an efficiency perspective, would it be better to actually include the data directly in the VBA code instead of referencing a sheet?

Thanks in advance.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
You can read a range into VBA without looping through each cell:

Code:
Dim vInput As Variant

vInput = Range("A1:T146000").Value2

But whether it is better to process an Excel range or a VBA array depends on what you intend doing with the data?

In some cases, it may be easier and more efficient to use Excel native functions rather than writing code to loop through a VBA array.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

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