Hi,
When I write a function, do I have to redefine my variables? What If i want to use a variable that I defined in my sub?
For example:
How do I use Wa in my function without redefining it?![]()
Please Login or Register to view this content.
Hi,
When I write a function, do I have to redefine my variables? What If i want to use a variable that I defined in my sub?
For example:
How do I use Wa in my function without redefining it?![]()
Please Login or Register to view this content.
pass it to the function as an argument
Josie
if at first you don't succeed try doing it the way your wife told you to
You could either declare Wa publicly.
Or, which is probably much better, pass it as an argument to the function.![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
If posting code please use code tags, see here.
Hi niko,
not sure what you mean. You don't have to redefine your variable, but you can assign different values to it later on. After you assigned the value "Worksheets(2)" to your variable, you can use it instead of it. Like this:is the same as![]()
Please Login or Register to view this content.
If your want to change the value, you just make another "Set" statement. For example![]()
Please Login or Register to view this content.
edit: never mind, I completely misunderstood.![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks