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>
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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
 
Upvote 0
the following code has worked.... Is it the most efficient way?

Windows("Workbook2.xlsx").Activate
 
Upvote 0
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
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top