How To Execute A Macro In Excel | Run Any Macro Fast

You can execute a macro in Excel through the Developer tab, a keyboard shortcut, the VBA editor, or by assigning it to a shape.

Macros automate repetitive tasks in Excel, but running them isn’t always obvious if you’ve never done it before. Whether you recorded your own macro or inherited one from a colleague, there are four reliable ways to run it — each suited for different situations. Before you can execute any macro, the workbook must be saved as a macro-enabled file (.xlsm or .xlsb), and macros must be enabled in Excel’s Trust Center. The steps below cover all the common execution methods, plus the security settings you’ll need to adjust.

Using the Developer Tab to Run a Macro

The Developer tab’s Macro dialog is the most straightforward way to run any saved macro. It works the same across Excel 2010 through Microsoft 365.

  1. Open the macro-enabled workbook (.xlsm or .xlsb).
  2. Go to the Developer tab. If you don’t see it, right-click the Ribbon, choose Customize the Ribbon, and check Developer.
  3. In the Code group, click Macros.
  4. Select the macro name from the list (for example, “FormatSalesTable”).
  5. Click Run.

For a visual walkthrough, GeeksforGeeks explains the macro dialog steps in detail.

Running a Macro with a Keyboard Shortcut

If you use a macro frequently, assign a keyboard shortcut for instant access without navigating menus. You can set or change a shortcut at any time.

  1. Open the Developer tab and click Macros.
  2. Select the macro you want to assign a shortcut to and click Options.
  3. In the Shortcut key box, type a letter (for example, R). The default shortcut will be Ctrl+R.
  4. To include Shift, hold Shift while typing the letter — you’ll get Ctrl+Shift+R.
  5. Click OK. Now pressing the shortcut runs the macro immediately.

Executing a Macro from the VBA Editor

The VBA editor is useful when you need to debug or run a macro that hasn’t been saved as a separate procedure, or when you want to run a part of the code line by line.

  1. Press Alt+F11 to open the Visual Basic Editor.
  2. In the Project Explorer pane, expand the project and locate the module that contains your macro (usually Module1 or a Sheet object).
  3. Double-click the module to open its code window.
  4. Place your cursor anywhere inside the SubEnd Sub block.
  5. Press F5 or click Run > Run Sub/UserForm.

Assigning a Macro to a Shape or Button

Turning a shape or an icon into a macro button makes the macro visible and clickable — ideal for sharing workbooks with less-technical users.

  1. Go to the Insert tab, click Shapes, and draw any shape on the worksheet.
  2. Right-click the shape and choose Assign Macro.
  3. Select the macro from the list and click OK.
  4. Click the shape to run the macro. You can also add text to the shape to label it.
Execution Method Steps Overview When to Use It
Developer Tab > Macros View list, select macro, click Run Quick one‑time runs; works on any sheet
View Tab > Macros Same dialog as Developer tab, accessible from View When Developer tab is hidden
Keyboard Shortcut Set via Macro Options, then press keys Daily‑used macros – fastest access
VBA Editor (F5) Open editor, place cursor in Sub, press Run Debugging or running code snippets
Assign to Shape Draw shape, right‑click > Assign Macro Sharing with others; visual button
Quick Access Toolbar File > Options > Quick Access Toolbar > Add macro button One‑click from any worksheet
Run from Module (double‑click) In VBE, double‑click a Sub name and press F5 When editing the macro itself

Enabling Macros So You Can Run Them

Excel blocks macros by default for security, so you must enable them before you can execute any macro. The setting lives in the Trust Center.

  1. Click File > Options > Trust Center > Trust Center Settings.
  2. Select Macro Settings.
  3. Choose Disable all macros with notification (recommended) or Enable all macros (use only for trusted sources).
  4. Click OK. When you open a macro‑enabled file from an untrusted location, a yellow security bar appears — click Enable Content to allow that file’s macros.

On macOS, you may also need to allow the “Microsoft Scripting Agent” in System Preferences if macros remain blocked.

Common Mistakes When Running Macros

Most execution problems come from one of a handful of easily fixed errors. The table below shows what to check first.

Mistake What Happens How to Fix It
Saving as .xlsx Macros are stripped from the file Re‑save as .xlsm or .xlsb
Macros disabled in Trust Center Nothing happens when you try to run Enable macros (with notification) and click Enable Content
Shortcut conflicts with built‑in Excel command Excel runs its own command instead of your macro Change the shortcut letter (avoid Ctrl+C, Ctrl+V, etc.)
Using “Use Relative References” incorrectly Macro runs on wrong cells each time Re‑record the macro with absolute references or check the code
Macro not stored in “This Workbook” It doesn’t appear in the macro list Open the workbook that contains the macro, or import the code
File downloaded from the internet Excel automatically marks it as untrusted Right‑click the file, choose Properties, check “Unblock”
Enterprise IT disables all macros You can’t run any macro, even with notification Contact IT to request a digitally signed macro or trusted location

How Do I Enable Macros After They’re Blocked?

When you open a macro‑enabled file from an untrusted source, Excel shows a yellow security bar with an Enable Content button. Click it to allow macros for that session. If the bar doesn’t appear, you can go to File > Info and click Enable Content from the “Security Warning” section.

Final Checklist for Running Macros

  • ✅ The workbook is saved as .xlsm or .xlsb.
  • ✅ Macros are enabled (Trust Center set to “Disable all macros with notification” and “Enable Content” clicked).
  • ✅ You have chosen a method: Developer tab / keyboard shortcut / VBA editor / shape / Quick Access Toolbar.
  • ✅ The macro is stored in “This Workbook” or in the workbook you’re currently using.
  • ✅ No shortcut conflicts exist for any assigned hotkeys.
  • ✅ If the file came from the internet, it has been unblocked in File Properties.
  • ✅ If running on a corporate network, verify that macros aren’t blocked by IT policy.

Once these conditions are met, any of the four main execution methods will work reliably across all modern versions of Excel on Windows and macOS.

References & Sources