Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable values
I've set up two macros "A" and "B" for use on a worksheet.
I assigned a value say 4 to a variable "v" in macro A. I find that the value 4 does not carry over to a variable "v" in macro B. Is there a way to have the variables of macro A apply to all other macros used with the worksheet? Thanks, Ed |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable values
DIM the variable before the macros in the module:
DIM v Sub a() .. .. .. End Sub Sub b() .. .. .. End Sub -- Gary''s Student "Ed" wrote: I've set up two macros "A" and "B" for use on a worksheet. I assigned a value say 4 to a variable "v" in macro A. I find that the value 4 does not carry over to a variable "v" in macro B. Is there a way to have the variables of macro A apply to all other macros used with the worksheet? Thanks, Ed |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable values
"Ed" wrote in message ... I've set up two macros "A" and "B" for use on a worksheet. I assigned a value say 4 to a variable "v" in macro A. I find that the value 4 does not carry over to a variable "v" in macro B. Is there a way to have the variables of macro A apply to all other macros used with the worksheet? If the macros are in one module: put a 'Dim v' statement at the beginning of the module (in the General section). Your variable will be recognizes in all macros (do not but a Dim v statement into any of your macros, this would override the general declaration. If macros are in separate modules, put a 'Public v' statement into the general section of any module. Joerg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Assigning values to a variable set | Excel Discussion (Misc queries) | |||
Sum of values in variable range | Excel Discussion (Misc queries) | |||
variable for Y values in chart | Charts and Charting in Excel | |||
SUM formula - using variable values | Excel Worksheet Functions | |||
Maintaining VBA variable values | Excel Discussion (Misc queries) |