To run one macro from another macro, insert a Call statement with the name of the second macro, or simply type the second macro's name on its own line, inside the body of the first macro. Both are valid VBA and both work in any Excel version that supports macros. The Call form is the clearer of the two and is what most people use. For example, if a subroutine named FormatReport already exists, a second macro can run it with Call FormatReport or just FormatReport. From there the practical questions are how to pass values between the two macros, how to keep the second macro from showing up in the macro list, and what to do when the call silently fails.

What You'll Need

  • Excel on Windows or Mac with macro support enabled. Workbooks containing VBA must be saved as .xlsm; the newer .xlsx format cannot store macros.
  • A workbook with at least two existing macros, or permission to create them. If macros are new to you, the Developer tab must be visible: right-click the ribbon, choose Customize the Ribbon, and tick Developer in the list on the right.
  • Access to the Visual Basic Editor, opened with Alt+F11 on Windows or Fn+Option+F11 on most Macs. The editor layout and menu names are largely the same on both, though dialog wording can differ slightly by version.
  • A trusted location or a macro-enabled workbook you are allowed to run. Windows Excel blocks macros from files downloaded from the internet until you unblock them in the file's properties.

Step-by-Step

  1. Open the editor and find your macros. Press Alt+F11, then double-click the relevant module under VBAProject in the Project Explorer on the left. If the macros are not there, go to Insert > Module and paste them in. Keep in mind that ribbon and menu labels can differ slightly by Excel version, so a command may sit in a nearby menu.
  2. Confirm both macros are Sub procedures, not Functions. They should read Sub FirstMacro() and Sub SecondMacro(). A Function only returns a value and cannot be run on its own, so it cannot be called the way a Sub can. If the second routine is a Function, either convert the calling line to use its return value or change it to a Sub.
  3. Write the calling macro. Create a new Sub that will act as the coordinator, for example Sub RunAll(). Decide the order you want the work done, because VBA executes each line top to bottom and does not continue past a line until it finishes.
  4. Add the call statement. Inside RunAll, type Call SecondMacro on its own line. The bare form, just SecondMacro, behaves identically, but the Call keyword makes the intent obvious to anyone reading the code later. Repeat the line for any further macros you want chained.
  5. Handle arguments if the called macro takes them. If the second macro is declared as Sub SecondMacro(sheetName As String), the call must supply the value: Call SecondMacro("Summary"). When using Call, arguments go inside parentheses. When dropping the keyword, omit the parentheses: SecondMacro "Summary". Getting this wrong produces a compile error about the argument list.
  6. Decide whether the called macros should be visible. Any Sub with no arguments appears in the macro dialog (Alt+F8). To hide helper macros from that list, add the word Private in front of Sub: Private Sub SecondMacro(). A Private macro can still be called from another macro in the same module, but not from a different module.
  7. Test with the step-through tool. Place the cursor inside RunAll and press F8 to execute one line at a time. This shows whether control is genuinely transferring to the second macro and lets you spot the exact line where something goes wrong. F5 runs the whole thing.
  8. Save as a macro-enabled workbook. Use File > Save As and pick Excel Macro-Enabled Workbook (.xlsm). Saving as a plain .xlsx triggers a warning that the macros will be removed.

Common Mistakes

  • Calling a macro in a different module with Private in front of it. Private limits visibility to the module the Sub lives in. Move the helper macro into the same module, or remove the keyword.
  • Naming a macro after a reserved word. A Sub called Print or Save can clash with built-in names and cause confusing errors. Use descriptive names like PrintInvoice.
  • Turning off screen updating and status bar in a called macro without restoring them. If the second macro sets Application.ScreenUpdating = False and ends without setting it back to True, Excel appears frozen afterwards. Set it back at the end of the same routine.
  • Forgetting that End stops everything. A bare End statement inside a called macro terminates the whole call chain immediately, not just that macro. Use Exit Sub to leave a routine early instead.
  • Leaving error handling unreset. If the first macro turns on On Error Resume Next, the called macro inherits it unless it sets its own handler. Reset it with On Error GoTo 0 where handling is no longer wanted.
  • Hard-coding sheet names in calls. Renaming a worksheet later breaks the call silently. Pass the sheet as an argument or refer to it by index with care.

Tips

  • Keep a single coordinator macro visible in the macro list and mark every helper Private. Users then see one clean entry point instead of a dozen half-finished routines.
  • Have the called macro report success or failure by returning a Boolean through a Function, or by setting a module-level variable. That lets the coordinator stop the chain when an early step fails.
  • Record a timestamp or write a note to a log sheet at the start of each called macro. When several routines run in sequence, this makes it obvious which one stalled.
  • Call Application.Run instead of Call when the target macro lives in another open workbook: Application.Run "'Budget.xlsm'!RefreshData". The workbook must be open for this to work.
  • Group related macros in standard modules rather than in sheet or ThisWorkbook code modules. Sheet modules are tied to specific objects and are harder to reuse.

Troubleshooting

The call does nothing. Step through with F8 and watch which line is highlighted after the call line. If the highlight skips straight past, the macro name is misspelled or the Sub is Private in another module. If the highlight never reaches the call line, an earlier line is failing or an earlier macro ended with End.

Compile error: expected sub, function or property. Usually a missing or extra parenthesis, or a name that does not exist. Check whether the called macro takes arguments and adjust the call accordingly.

Macro cannot be found at runtime. Confirm the workbook containing it is open if you are using Application.Run, and confirm the workbook name includes the extension and is wrapped in single quotes when the name contains spaces.

Excel appears to hang after the chain finishes. Screen updating was probably left switched off. Press Ctrl+Break on Windows or Command+Period on Mac to interrupt, then restore the setting in code. Nothing in the file is lost by interrupting a paused run, but any unsaved changes made by the macros are.

Macros are greyed out. Close the workbook, right-click the file in File Explorer, open Properties, and tick Unblock if it appears. Also check that the macro security setting in the Trust Center allows macros in the folder you keep the workbook in.

Frequently Asked Questions

Do I have to use the word Call?

No. Writing the macro name on its own line works the same way. Call is clearer and is required if you want parentheses around the arguments.

Can one macro in a different workbook be run this way?

Yes, with Application.Run and the workbook-qualified name, as long as that workbook is open.

How do I stop a called macro from appearing in the Alt+F8 list?

Declare it as Private Sub in the same module as the macro that calls it. It remains callable from that module only.

Can a macro pass a value back to the macro that called it?

Not through Call with a Sub. Use a Function and assign its result to a variable, or store the value in a module-level variable that both routines can read.

Does the calling macro keep running if the called one hits an error?

Only if error handling allows it. Without a handler, an unhandled error stops execution of the entire chain at that point.