How to Enable & Run a Macro in Excel? 6 Ways
Last Updated :
06 Dec, 2023
We can record a macro in Excel or write from scratch in VB Editor. Excel provides different options to run a macro. In this article, we explore four different approaches to running a macro in an Excel application.
Even while executing an Excel macro is a straightforward process for seasoned users, it might not be clear to newbies. You will discover numerous ways to execute macros in this article, some of which may entirely alter the way you interact with Excel files.
The below macro will write the text “Geeks for Geeks” in cell B5
Sub updateText()
ActiveSheet.Range(“B5”).Value = “Geeks for Geeks”
End Sub
How to Run a Macro from Excel Ribbon
Follow the below steps to run a macro in the Macro dialogue box:
Step 1. Go to View >> Macros >> View Macros – to pop-up Macro dialogue box [keyboard shortcut – Alt+F8].

Step 2. Select a Macro from the list (e.g. updateText) and Press “Run”

Output:

How to Run Macro from VBA Editor
Follow the below steps to run a macro in VBE:
Step 1. Open Excel
Step 2. Go to Developer>> Visual Basic – to open VBA Editor [keyboard shortcut – Alt+F11]

Step 3. Select anywhere in the macro code and click the “Run button” (Green Arrow) or Press F5

How to Run a Macro with Custom Keyboard Shortcut in Excel
Follow the below steps to assign a keyboard shortcut to execute a Macro:
Step 1. Go to View >> Macros >> View Macros – to pop-up Macro dialogue box [keyboard shortcut – Alt+F8]
Step 2. Select Macro from the list (e.g. updateText) and Press “Options”, to pop-up Macro Options

Step 3. Give any specific text in shortcut key input [e.g. Ctrl+p] and Press “OK”. Close Macro list

Step 4. Just press your Shortcut key, e.g. Ctrl+p, to execute the macro.
How to Create a Macro Button in Excel
Follow the below steps to add a shape in Excel to execute a macro:
Step 1. Click Insert in the Controls group of the Developer tab, then choose Button under From Controls. Add a button, “Run Macro”

Create a Macro Button

Step 2. Right-click Shape and Press “Assign Macro”, to pop up the Assign Macro dialogue box

Step 3. Select “updateText” Macro and Press “OK”

Step 4. Just click the shape “Run Macro” in your Excel file to run the macro
The macro can now be executed by clicking its button. The assigned macro formats the chosen cells as seen in the screenshot below.
How to Create a Macro Button from a Graphic Object
Unfortunately, button controls cannot have their appearance customized, which is why the button we just constructed does not look very beautiful. You can use shapes, icons, pictures, WordArt, and other things to create a really lovely Excel macro button.
Follow the below steps to create a Macro button from a Graphic Object:
Step 1. Select the Illustrations group, from the Insert Tab, Select Shapes, and choose the desired shape
Step 2. Click on your worksheet and then place the shape object there and create your shape button in the desired format
Step 3. Right-click the shape object, select Assign Macro from the context menu, then select the required macro and press OK to bind the macro to the shape
Now you have a shape that resembles a button and when you click on it, it executes the designated macro.

Run the macro by clicking on the shape
How to Add a Macro Button to Quick Access Toolbar
The macro button added to a worksheet looks nice, but it takes time to add a button to every sheet. Add your preferred macro to the Quick Access Toolbar to make it accessible from anywhere.
Step 1. Use the context menu by right-clicking the Quick Access Toolbar and selecting More Commands
Step 2. Select Macros
We can make a few more adjustments or click OK to save the changes
Step 4. If the icon added turns out to be unsuitable for your macro, click Modify to change it to a different icon

Step 5. Select a desired icon for your macro button from the Modify Button dialogue box
Step 6. Click on OK once done
Well Done! You now have a button on Excel that will start a macro.

You just need to select the Excel macro execution method that best suits your requirements now that you are aware of the various available options. I appreciate your time and hope to see you on some of our other blogs.
Similar Reads
How to Enable Dark Mode in Excel (Windows & Mac)
Reduce eye strain and enhance your productivity with Excel's Dark Mode! This guide provides easy-to-follow steps on how to enable Dark Mode in Microsoft Excel for both Windows and Mac. Learn how to customize your Excel experience with a visually appealing and less-distracting interface. What is Exce
3 min read
How to Delete a Module in Excel VBA?
Have you ever seen a text file in a notepad or a source code file in visual studio code? These all are just basic files where you can write some code or information. Similarly, we have modules in excel, each module has its code window, where you can write some code and allow it to automate your repe
3 min read
How to Enable and Use Power View in Excel?
Power View is a sophisticated visualization feature in Microsoft Excel that enables users to generate graphs, charts, and reports. It makes it easy for organizations to produce reports and dashboards that can be shared on a daily, weekly, and monthly basis with stakeholders, managers, and other team
4 min read
How to Record a Macro in Excel
Excel Macro is simply a record button that records a set of actions performed on Excel that can be run multiple times. For example, if you have to format some raw data on a weekly basis you can use a macro to record yourself formatting the data once and let Excel automate the task in the future. it'
11 min read
How to Insert and Run VBA Code in Excel?
In Excel VBA stands for (Visual Basic for Application Code) where we can automate our task with help of codes and codes that will manipulate(like inserting, creating, or deleting a row, column, or graph) the data in a worksheet or workbook. With the help of VBA, we can also automate the task in exce
2 min read
How Can I Enable Python in Excel?
Excel and Python are a dynamic combination that may help anyone improve their automation and data analysis skills. Not only can Python help you become more proficient with spreadsheets, but it can also revolutionize efficiency and insight. This is how to easily enable Python in Excel to open up a pl
3 min read
How to Run Code from a Module in Excel VBA
VBA Macro is for developers. In Excel, the macro is a piece of code written in VBA and VBA is Microsoft's programming language, it stands for Visual Basic for Applications. The module is a file with a .bcf extension that stores the code written in the Visual Basic for Applications editor. Let's lear
4 min read
How to Enable Macros in Excel (2025): Step-by-Step Guide
How to Activate Macros in Excel - Quick StepsOpen the Excel workbook.Click Enable Content in the yellow security warning bar.Go to File > Options > Trust Center > Trust Center Settings > Macro Settings.Choose the desired macro setting (e.g., Enable All Macros for trusted files).Save the
9 min read
How to Configure Macros in Excel
An action or collection of actions can be recorded, named, stored, and executed as many times as necessary and whenever desired using an Excel macro. We can automate repetitive data manipulation and reporting processes that need to be done repeatedly by using macros. You can record a macro and save
4 min read
How to Create a Macro in Excel: Build, Run, and Use Macros Easily
How Do I Create a Macro in Excel- Quick StepsOpen MS Excel > Start Recording a MacroPerform the Actions You Want to Automate > Stop RecordingRun the MacroAre repetitive tasks consuming your time in Excel? With this Excel macros tutorial, you can learn how to create and use macros in Excel to a
8 min read