Sharing Variables

G

Guest

I give a variable a value in a macro inside a worksheet. I want it to be
available later in other macros in other worksheets and in "ThisWorkbook".
How do I do this?

Thanks.
 
D

Daniel CHEN

If you want the variable to be accessable in the same module, you can define
the variable (use dim statement) outside of all functions/procedures and put
it at the top of coding.

If you want the variable to be accessable in other modules, use public
statement.


--
Best regards,
---
Yongjun CHEN
==================================
- - - - www.XLDataSoft.com - - - -
Free Excel/VBA Tool & Training Material
==================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top