Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variables Between Workbooks
Greetings,
I have a variable in one workbook that I want any other open workbook to recognize. For example, workbook A declares variable X. I want workbook B to also recognize variable X from workbook A. I am a VBA novice, so please use layman's terms with your reply. Many thanks, David |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variables Between Workbooks
You would need a function in workbookA that would return the value of that
variable In a general module in WorkbookA.xls ' in the declarations section Public lngVar as Long ' in the code section Sub SetVar() ' or some code to set the value of the public variable lngVar = int(rnd()*1000+1) End Sub Public Function MyVariable() MyVariable = lngVar End Function then in the other workbooks you can do lngA = Application.Run("WorkbookA.xls!MyVariable") -- Regards, Tom Ogilvy wrote in message ups.com... Greetings, I have a variable in one workbook that I want any other open workbook to recognize. For example, workbook A declares variable X. I want workbook B to also recognize variable X from workbook A. I am a VBA novice, so please use layman's terms with your reply. Many thanks, David |
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) | |||
Copy/ move selected data from workbooks to seperate worksheets or workbooks | Excel Worksheet Functions | |||
Display 2 formulas from source workbooks to destination workbooks | Excel Discussion (Misc queries) | |||
suddenly my excel workbooks are "shared workbooks" | Excel Discussion (Misc queries) | |||
In Excel how do I put variables in links to other workbooks? | Excel Worksheet Functions |