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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
36,160
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
36,160
Office Version
365
Platform
Windows
Glad to help & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,090,508
Messages
5,414,967
Members
403,558
Latest member
Hardeni

This Week's Hot Topics

Top