Save a variable value outside a macro
A global variable will hold its value as long as your code is in
memory, ie
In the general declarations section type:
Public MyVar as Single
If you want the value to be stored even after your workbook has closed
then you will need to store it either in a cell in the workbook itself
or in a text file (from which you can read it again when your workbook
reopens). There are many approaches to achieve the latter - search for
'Open Statement' in vba help for one of the simpler ones.
Good luck,
Andrew
|