Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
so in a subroutine, i set a variable in the middle of script, and
aftewards, i wanted to use that variable globally....can i take a variable and set a global variable with it from inside a subroutine? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Declare the variable outside the sub at the top of the module, but define it as you did inside the sub. Then Dim myVariable at the top of the sub can be used inside that module. Also Public myVariable at the top of the sub can be used inside the project regards Paul Nigel wrote: so in a subroutine, i set a variable in the middle of script, and aftewards, i wanted to use that variable globally....can i take a variable and set a global variable with it from inside a subroutine? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Make it a function and return that value as the function result to the
caller. -- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "Nigel" wrote in message ups.com... so in a subroutine, i set a variable in the middle of script, and aftewards, i wanted to use that variable globally....can i take a variable and set a global variable with it from inside a subroutine? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Global variable | Excel Discussion (Misc queries) | |||
Error #1004 routine send emails | Excel Discussion (Misc queries) | |||
How to keep a Variable alive after a Call to Sub Routine | Excel Discussion (Misc queries) | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions | |||
VBA routine to assign first name only to a variable | Excel Programming |