How to call and run a Macro (StatusV2) stored on Workbook1 onto Workbook2

Vaghela

New Member
Joined
Oct 28, 2017
Messages
16
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">Hi All

How do I run a macro module. This macro is on workbook1 and everyday i want it to be run on a another workbook (named workbook2). Workbook2 needs to be non macro enabled workbook. Both the Workbook are opened.
I was not able to get any appropriate code which completes this action. Any assistance would be appreciated.

I dont think the following code is of any help in the above scenario.

Application
.Run "'"& Workbook1&"'!StatusV2"

Thanks
Vaghy

</code>
 

Some videos you may like

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
35,542
Office Version
365
Platform
Windows
If workbook2 has to be an .xlsx file then you cannot call a macro from it.
However if at the top of your macro insert
Code:
Workbooks("Workbook2.xlsx").activate
That might enable you to do what you're after.
If that doesn't work you'll need to post your code here
 

Vaghela

New Member
Joined
Oct 28, 2017
Messages
16
the following code has worked.... Is it the most efficient way?

Windows("Workbook2.xlsx").Activate
 

Vaghela

New Member
Joined
Oct 28, 2017
Messages
16
If workbook2 has to be an .xlsx file then you cannot call a macro from it.
However if at the top of your macro insert
Code:
Workbooks("Workbook2.xlsx").activate
That might enable you to do what you're after.
If that doesn't work you'll need to post your code here

thanks for your assistance
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
35,542
Office Version
365
Platform
Windows
Glad to help & thanks for the feedback
 

Forum statistics

Threads
1,089,278
Messages
5,407,347
Members
403,135
Latest member
becca_832313

This Week's Hot Topics

Top