Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variables
I'm new to VBA and I'm trying to define a variable in one
subroutine and use it in another subroutine but the variable is resetting to zero in the second subroutine. What am I missing? Thank you for any help with this. Sub DownOne() RowOffset = 1 'defining the variable Combine 'Second Subroutine End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variables
Tim U wrote:
I'm new to VBA and I'm trying to define a variable in one subroutine and use it in another subroutine but the variable is resetting to zero in the second subroutine. What am I missing? Thank you for any help with this. Sub DownOne() RowOffset = 1 'defining the variable Combine 'Second Subroutine End Sub You might try Sub Combine(rowOffset) 'whatever End Sub Sub DownOne() RowOffset = 1 Call Combine(RowOffset) End Sub Alan Beban |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variables
Try declaring the variable as Public, at the very top of
the module. Public makes the variable available to all modules in all, declaring them as Private makes the variable only available to all procedures in the same module. Have a look under Help, Declaring variables. Or look at Public, Private and static to find which declaration best suits your needs. All the best DavidC -----Original Message----- I'm new to VBA and I'm trying to define a variable in one subroutine and use it in another subroutine but the variable is resetting to zero in the second subroutine. What am I missing? Thank you for any help with this. Sub DownOne() RowOffset = 1 'defining the variable Combine 'Second Subroutine End Sub . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Not at all clear on use of variables and/or object variables | Excel Discussion (Misc queries) | |||
More than 1 Variables | Excel Discussion (Misc queries) | |||
DIm Variables | Excel Programming | |||
Variables | Excel Programming | |||
variables | Excel Programming |