accessing variant after macro has ended

RAYLWARD102

Well-known Member
Joined
May 27, 2010
Messages
529
I have a public variable declared in a Module, that's triggered by worksheet change event; My public variable ceases to exist after the Module subroutine completes. How do I preserve a Public variable in memory, for use later on? Is there a way? Basically want to be able to retrieve that variable without after an extended amount of time has passed, where the user is not running any macros (just using the workbook sheets) until the change event occurs once again.


EDIT:
basically want a non-expiring variable; one that remains active until workbook project is closed.
I did read about ActiveWorkbook.CustomDocumentProperties, but these properties can't seem to store an array (variant)
 
Last edited by a moderator:
- An ActiveX control is added to any sheet in the workbook containing the VBAProject (!)

Do you mean the presence of an ActiveX control on any sheet, or the action of programatically adding one?
 
Upvote 0

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
Do you mean the presence of an ActiveX control on any sheet, or the action of programatically adding one?

Only when adding the ActiveX control at runtime because it resets the VBE and all values stored in variables are released
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,263
Members
452,627
Latest member
KitkatToby

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