I need help to merge two macros. VBA code

Closed
carman - Aug 1, 2010 at 09:47 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Aug 2, 2010 at 09:16 AM
Hello,

I need help to merge two macros. Bascially, after "MACRO1" finishes running in File 1 ( macro 1 itself located in file 1), i want excel to run " MACRO 2" in File 2 (macro 2 itself located in file 2) . I tried using the following code:

Windows("2.xls").Activate
Application.Run "2.xls!Macro2"
However, Instead of running in file 2, it runs in file 1 which overwrite all the original data i had in File 1. ( It goes back to 1.xls even i gave the code Windows("2.xls").Activate)

My target: After excel finished all the updates in file 1 by macro 1, i would like macro 2 to excute the command i put in macro 1 in file 2. What can i do to tell excel to run in the different file instead of the one file that i wrote the codes on?I need a VBA code that can help me to achiece this. Can anyone help??

Thanks.
Related:

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Aug 2, 2010 at 09:16 AM
I dont think there is a need to repeat your question in each sub forum :P
0