First of all, ensure that you have Option Explicit as the very
first line in the code module (before and outside of any
procedure). This will force you to declare all your variable
rather than have VBA automatically allocate variable at run time.
Then read up on "scope" in the VBA Help file.
If you declare (Dim) the variable within Macro1, that variable is
accessible only within Macro1. When Macro1 exits, the variable is
destroyed. If you need to use calculated variables in more than
one procedure, declare them as Public outside of and before any
procedure.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Jeff" wrote in message
...
Sorry to keep asking questions about passing variables, but
here is another
one hope you can help.
I have a macro that received one set of values so I call it
Macro1(X), where X is the value that is received. But
Macro1(X) calculates
about 20 other variables Y,Z,A,.... using the value X. If I
call Macro1(X)
and I need one of the variables how do I get it, do I have to
declare global
variables.
Thanks