Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Using Variables in Two Workbooks

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Using Variables in Two Workbooks

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Using Variables in Two Workbooks

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare variables in two excel workbooks Alex Excel Programming 7 October 29th 08 11:46 PM
Passing Variables between Workbooks Patrick Kirk Excel Programming 3 December 26th 07 07:56 PM
Passing variables between workbooks mliungman Excel Programming 9 January 13th 06 02:22 PM
Variables Between Workbooks [email protected] Excel Programming 1 May 25th 05 01:47 AM
In Excel how do I put variables in links to other workbooks? bwh2o Excel Worksheet Functions 2 April 22nd 05 03:54 AM


All times are GMT +1. The time now is 04:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"