Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Passing variables between workbooks | Excel Programming | |||
Passing Control when workbooks have the same name | Excel Programming | |||
Passing Macros Between Workbooks | Excel Programming | |||
Passing a variable between workbooks | Excel Programming | |||
Passing Execution Control Between Workbooks | Excel Programming |