Storing Values in Module?

Mr Denove

Active Member
Joined
Jun 8, 2007
Messages
446
Afternoon, I have a simple problem but one which I am not yet experienced / understanding on how to create it.

I do alot of calculations in a source workbook, this data then feeds into the Main workbook (where the code is contained).

How do I retain each calculated value in the Source workbook and update the Main workbook after all calculations are completed?

Thanks in advance.

Stuart
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
The simplest way would be to write the values that you want preserved into cells of the workbook.
Formulas are the ususual way to get the results of a calculation into a cell.

Then in the master workbook formulas like =[SourceWorkbook.xlsx]Sheet1!$A$1 will pull the data from SourceWorkbook, once the cell address has been adjusted to your actual names and layout.
 
Upvote 0
Hi Mike, many thanks for your reply.
I had gone down this route, as you have also suggested this it does seem the best way forward.
Was just hoping I could store the values in the code (and thus improve my VBA knowledge) when moving a value,string etc between
 
Upvote 0
You can use Global VBA variables to store dynamic values, but they are only stored for the duration that a VBA procedure is run.
Once you close the workbook, or run some other procedures, those values are gone/reset.
So VBA is not a good place to store values. Saving them to the workbook is the way to go. People often use hidden sheets or ranges to store them, if you do not wants users to see that.
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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