Run a Macro from Another Macro in Excel

Add to Favorites
Author:

I will show you how to run a macro from another macro in Excel.  This means that you can run any macro when you need to from a completely separate macro.

This is actually very simple!

Use Call in VBA.

Here is the macro we want to call or run using another macro:

Sub Macro_2()

 

MsgBox "Hi!"

 

End Sub

And here is the macro that will call or run this macro:

Sub Macro_1()

 

'call the second macro

Call Macro_2

 

End Sub

It is as simple as that.  Put Call in front of the name of the macro that you want to run.

Here is a screenshot of these two macros in Excel:

Download the spreadsheet for this tutorial, from below or the side-bar of this page, and you can test out these macros.

 


Downloadable Files: Excel File

Question? Ask it in our Excel Forum


Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Similar Content on TeachExcel
Use Macros with UserForms
Tutorial: This tutorial explains how macros interact with UserForms. This includes an explanation of...
Automatically Run a Macro so Many Seconds, Minutes, or Hours After an Excel Workbook has been Opened
Macro: Run a macro after a certain amount of time has passed since the Excel workbook was ope...
Run a Macro when a User Does Something in the Worksheet in Excel
Tutorial: How to run a macro when a user does something in the worksheet, everything from selecting ...
Stop a Macro from Running in Excel
Tutorial: How to stop a macro from running after it has started. This method uses the keyboard an...
Run a Macro When a Specific Cell Changes in Excel
Tutorial: Run a macro in Excel when a specific cell is changed; this also covers when a cell within...
Login to a Website using a Macro
: Connect and login to a website using a macro in Excel. This allows you to open a website a...
Tutorial Details
Downloadable Files: Excel File
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course