Locked lesson.
About this lesson
Setting up a master macro allowing you to call other macros from a single source.
Exercise files
Download this lesson’s related exercise files.
Calling other macros.xlsm27.2 KB Calling other macros - Completed.xlsm
29.3 KB
Quick reference
Calling other macros
Lining multiple subroutines together
When to use
To call one macro from within another subroutine
Instructions
It is a best practice to create a "Master" routine that calls smaller sub-macros instead of writing one long macro
Benefits of calling other macros
- Allows for easier debugging
- Allows you to re-use routines should you need them more than once
Syntax for calling another macro
Sub MyMasterMacroName
Call Macro1Name
Call Macro2Name
End Sub
Setting Macros to Private
- Optionally, you can insert the word Private before Sub when creating a Macro
- Private Subs do not show up in Excel's Macro dialog
- Private Subs can still be called from other macros in the same code module
Hints & tips
- The Call keyword is optional, but recommended as it makes your code easier to read later
Lesson notes are only available for subscribers.