Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Passing a value across workbooks

Excel XP & Win XP
I have a WB, say BBB.xls.
It has a macro, say MyMacro.
MyMacro uses the variable TheRow.
The code in BBB.xls calculates the value of TheRow and calls MyMacro.
Let's say the last value of TheRow was 20.
All works great.

I have another WB, say AAA.xls.
The code in AAA.xls calculates the value of TheRow as, say 15, and calls
MyMacro in BBB.xls with:
Application.Run.....................
MyMacro runs.
The problem: MyMacro uses 20 as the value of TheRow, not 15.
My question: How can I pass the new value of TheRow in the MyMacro call?
Possible solution is to write a macro in BBB.xls that gets TheRow from
AAA.xls and then calls MyMacro, and then have AAA.xls call that new macro
instead of MyMacro. This sounds good except for the fact that the file name
of the AAA.xls file is a variable. That muddies the water.
Thanks for your time. Otto



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Passing a value across workbooks

Change your macro to have arguments, and pass 15 as a call parameter

Application.Run "BBB.xlsmyMacro", TheRow

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Otto Moehrbach" wrote in message
...
Excel XP & Win XP
I have a WB, say BBB.xls.
It has a macro, say MyMacro.
MyMacro uses the variable TheRow.
The code in BBB.xls calculates the value of TheRow and calls MyMacro.
Let's say the last value of TheRow was 20.
All works great.

I have another WB, say AAA.xls.
The code in AAA.xls calculates the value of TheRow as, say 15, and calls
MyMacro in BBB.xls with:
Application.Run.....................
MyMacro runs.
The problem: MyMacro uses 20 as the value of TheRow, not 15.
My question: How can I pass the new value of TheRow in the MyMacro call?
Possible solution is to write a macro in BBB.xls that gets TheRow from
AAA.xls and then calls MyMacro, and then have AAA.xls call that new macro
instead of MyMacro. This sounds good except for the fact that the file
name of the AAA.xls file is a variable. That muddies the water.
Thanks for your time. Otto





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
Passing variables between workbooks mliungman Excel Programming 9 January 13th 06 02:22 PM
Passing Control when workbooks have the same name shawb[_3_] Excel Programming 5 September 28th 05 01:59 PM
Passing Macros Between Workbooks Bernie Deitrick Excel Programming 1 June 30th 04 05:02 PM
Passing a variable between workbooks Rich Cooper Excel Programming 1 May 19th 04 07:27 PM
Passing Execution Control Between Workbooks RSnyder[_2_] Excel Programming 0 May 7th 04 02:01 PM


All times are GMT +1. The time now is 05:38 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"