Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If I have two workbooks open, and Workbook A has a couple of arrays with
information I want to use in Workbook B, how do I go about getting the information into Workbook B? I thought using a Public declare would work, but it doesn't seem to. -- Bill @ UAMS |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You need to set a reference from Workbook A to Workbook B. In VBA with
Workbook B active and open, go to the Tools menu, choose VBA Project Properties and change the name to something unique like projBookB. Then, open Workbook A in VBA, go to the Tools menu, choose References, and put a check next to projBookB. Then, back in Workbook A, you can reference anything in WorkbookB by prefixing "projBookB." to the variable name. E.g,. X = projBookB.MyVariable If "MyVariable" occurs ONLY in workbook B, not in A, you can omit the "projBookB." prefix, but I think this is bad form. You should always use the prefix to indicate that you're linking to another library. Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel, 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com On Mon, 15 Mar 2010 14:34:01 -0700, BillCPA <Bill @ UAMS wrote: If I have two workbooks open, and Workbook A has a couple of arrays with information I want to use in Workbook B, how do I go about getting the information into Workbook B? I thought using a Public declare would work, but it doesn't seem to. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks so much.
If you had a dollar for every time you have answered some of these questions, . . . . . -- Bill @ UAMS "Chip Pearson" wrote: You need to set a reference from Workbook A to Workbook B. In VBA with Workbook B active and open, go to the Tools menu, choose VBA Project Properties and change the name to something unique like projBookB. Then, open Workbook A in VBA, go to the Tools menu, choose References, and put a check next to projBookB. Then, back in Workbook A, you can reference anything in WorkbookB by prefixing "projBookB." to the variable name. E.g,. X = projBookB.MyVariable If "MyVariable" occurs ONLY in workbook B, not in A, you can omit the "projBookB." prefix, but I think this is bad form. You should always use the prefix to indicate that you're linking to another library. Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel, 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com On Mon, 15 Mar 2010 14:34:01 -0700, BillCPA <Bill @ UAMS wrote: If I have two workbooks open, and Workbook A has a couple of arrays with information I want to use in Workbook B, how do I go about getting the information into Workbook B? I thought using a Public declare would work, but it doesn't seem to. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Compare variables in two excel workbooks | Excel Programming | |||
Passing Variables between Workbooks | Excel Programming | |||
Passing variables between workbooks | Excel Programming | |||
Variables Between Workbooks | Excel Programming | |||
In Excel how do I put variables in links to other workbooks? | Excel Worksheet Functions |