excelmacroMacros are little programs that run within Excel and help automate common repetitive tasks. Macros are one of Excel’s most powerful, yet underutilized feature. Using macros, you can save hours and boost productivity manifold.

In this blog post, we will learn how to create an ultra-simple macro in Excel 2013 to introduce you to the concept. For a more detailed overview of advanced Excel functions, including creating complicated macros, try the comprehensive Excel training course for beginners and intermediate users.

What is a Macro?

A macro can be defined as the recording of a series of tasks. It’s the simplest form of automation – show a software program the steps you follow to get something done, and the software will follow along. When used right, macros can save you hours by automating simple, repetitive tasks.

Marcos in Excel are written in Excel VBA (Visual Basic for Applications). This is a version of Visual Basic (a prominent Microsoft programming language) developed specifically for use in Office-like applications. Creating simple macros – copy a formula from one cell to another, for instance – is fairly easy. Complicated macros require a bit more work. You’ll need to be quite intimate with Excel VBA to automate the more complex tasks in your workflow. You can learn more about these in this advanced Excel 2010 course.

For this tutorial, we will create a very simple macro to get you up to speed with Excel programming and automation.

Step 1: Activate the Developer Toolbar

To write macros, you will need access to the Developer toolbar in the top ribbon. This is hidden by default. To activate it, go to File -> Options -> Customize Ribbon and check the box next to ‘Developer’.

 

Press OK. You should now see the Developer toolbar in the ribbon.

 

Step 2: Enable Macros

Macros are disabled by default in Excel. This is to protect you from malicious macros running automatically in downloaded Excel files.

To use macros, you will have to first enable them from the Trust Center. To do this, go to File -> Options -> Trust Center. Click on the ‘Trust Center Settings’ button in this menu.

 

In this new window, go to ‘Macro Settings’ and select the ‘Enable all macros’ radio button.

Click OK. You can now start using macros in your Excel spreadsheets.

Step 3: Prepare the Spreadsheet

In this tutorial, we will create a very simple macro to change the color, size and boldness of text.

In your spreadsheet, type in some text in any of the cells. We will later record a macro to change the formatting of this text.

Now that our spreadsheet is ready, we can start creating the macro.

Step 4: Create a New Macro

In the ‘Developer’ tab, click on ‘Record Macro’

A pop-up window will ask you to give a name, storage location, shortcut and description for the macro.

Type in whatever you like over here. It helps to be descriptive with your macro titles. You might end up using dozens of macros in a large spreadsheet. Being able to quickly find individual macros by name will save you hours of frustration later. It’s also a good practice to add a description to remind you what the macro actually does.

Two important considerations here:

For the purpose of this tutorial, we will give our macro a shortcut of CTRL + SHIFT + A and store it within the same workbook.

Not sure how macros work? Try this comprehensive program to learn Excel 2010 from scratch.

Step 5: Record the Macro

Once you’ve entered all the require details, click OK. Your macro is now being recorded.

Select the cell where you entered your text. Switch to the ‘Home’ tab and change its color to red, font size to 18, and font weight to ‘bold’.

When you’re done, click on the ‘Stop Recording’ button in the Developer tab, or hit the small square block at the bottom of the spreadsheet next to ‘Ready’.

You have now successfully recorded an Excel macro!

Step 6: Test the Macro

Now that you’ve recorded your first macro, it’s time to see it live.

Add a few more blocks of text to your spreadsheet, one cell at a time. You might have to change the default formatting back to black font, 11 point font size and normal text.

Once you’ve added the text, simply select any cell and press the shortcut for your macro (CTRL + SHIFT + A). The formatting will immediately change to 18 pt. bold font in red color. You can apply this to each cell at a time, or select multiple cells together.

The formatting changes that would otherwise take you multiple clicks now take just one keystroke.

This is one of the most basic macros you can create. As you can imagine, complex macros can be created to perform very complicated tasks. You can learn more about creating such macros with Excel VBA programming in this Excel training course for advanced topics.

Was this tutorial helpful? We’d love to learn your thoughts and opinions! Share them with us in the comments below.

Top courses in Excel

Microsoft Excel - Excel from Beginner to Advanced
Kyle Pew, Office Newb LLC
4.6 (173,031)
Bestseller
Microsoft Excel - Data Analysis with Excel Pivot Tables
Maven Analytics, Chris Dutton
4.6 (21,309)
Bestseller
Microsoft Excel - Data Visualization, Excel Charts & Graphs
Maven Analytics, Chris Dutton
4.6 (15,938)
Bestseller
Excel PRO TIPS: 75+ Tips to go from Excel Beginner to Pro
Maven Analytics, Chris Dutton
4.7 (1,900)
Bestseller
MS Excel Exam Guide: Analyzing and Visualizing Data
Ben Young, Kirill Eremenko, Hadelin de Ponteves, SuperDataScience Team
4.6 (481)
Microsoft Excel 2010: Advanced Training
Infinite Skills
4.6 (2,359)

More Excel Courses

Excel students also learn

Empower your team. Lead the industry.

Get a subscription to a library of online courses and digital learning tools for your organization with Udemy for Business.

Request a demo