Alternate method to store data for use in any sub - Arrays don't work for this

gkis2

New Member
Joined
Dec 5, 2018
Messages
17
My original idea was to load an array (4D) with lots of data then call up the array as a variable and have it spit out the values that I want when I need them in other subs and/or in other modules. I haven't had any luck by searching the web, posting here or etc. The best advice I got was 'Don't use public or global variables, its bad practice'. So, now that I have surrendered, is there another way to still achieve what I am looking for without an Array? Is there another kind of variable that could work, another approach?? I know that I can put the data on a sheet then pull it from that sheet. Actually the data starts on a sheet (actually actually it starts as a CSV then gets dumped on a sheet using data sources for what that is worth). My main concern with that is the time it takes. There is a LOT of data. And that tends to take more complicated code which I like to avoid where I can. I have heard about collections but don't know a lot about them and I don't think they can do 4D although there is probably a way around that, as long as I can get to what I need reliably. Any help would be appreciated.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
If arrays don't suit, then I would think the only option is to pull the values from a worksheet, particularly since that's where they start. Just as you would use indices to access the data in a 4D array, why can't you use a calculation of those same indices to access a particular cell, row, or column? You would have to do something like that to load the array in the first place, anyway.
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

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