Running a Macro within a Macro!

welly_music

New Member
Joined
Jul 21, 2010
Messages
5
Hi there.

I have recorded a large macro to automate a few things ain a spreadsheet, and in this I have run a macro in the same workbook a number of times as follows :

Application.Run _
"myfilename.xlsm'!Calculate_residual"

When I save an iteration of this spreadsheet (it is a working property model), the code still points to the original document........ is there any way of removing this "myfilename.xlsm' reference so that the macro refers to the Calculate_residual macro in the saved iteration (ie current document) instead of the old version of the model where the macro was first recorded?

Thanks!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
If your current macro is running from Workbook1 you can call any other macro found on the same workbook by simply using
Code:
Call MyMacro
If you start your macro from "Workbook1" and your macro runs another macro from "Workbook2" that calls for yet another macro, the Call refers now to macros found from "Workbook2". When they're done the original macro takes over and once again the Call refers to macros found from "Workbook1" (=always the same workbook that the macro is running from).
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,245
Members
448,555
Latest member
RobertJones1986

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