Quick start: create a macro (2024)

Excel tot Microsoft 365 Excel for Microsoft 365 for Mac Excel 2021 also Mac Excel 2019 Excel 2019 also Mac Excel-2016 Excel 2013More or less

If you have tasks in Microsoft Excel that you perform repeatedly, you can record a macro to automate these tasks. A macro is an action or series of actions that you can perform as many times as you want. When you create a macro, you record your mouse clicks and keystrokes. After you create a macro, you can edit it and make minor changes to the way it works.

Suppose you prepare a monthly report for your accounting manager. You'll want to color the names of customers with past due accounts in red and also make them bold. You can create and then run a macro that quickly applies these formatting changes to the cells you select.

WindowsMac

How?

Quick start: create a macro (1)

Before recording a macro

Macros and VBA tools can be found atDevelopertab, which is hidden by default, so the first step is to enable it. For more information, seeShow the Developer tab.

Quick start: create a macro (2)

Quick start: create a macro (3)

Record a macro

  1. I thinkCodegroup onDevelopertab, clickRecord macro.

  2. Optionally enter a name for the macro iMacro nameenter a keyboard shortcut in the boxHotkeybox and descriptionDescriptionbox and then clickOkayto start recording.

    Quick start: create a macro (4)

  3. Perform the actions you want to automate, such as entering boilerplate text or filling a column with data.

  4. Am working on itDevelopertab, clickStop recording.

    Quick start: create a macro (5)

Quick start: create a macro (6)

Take a closer look at the macro

You can learn about the Visual Basic programming language by editing a macro.

To edit a macro, iCodegroup onDevelopertab, clickMacro's, select the macro name and clickEditing. Dette starter Visual Basic Editor.

See how the actions you recorded appear as code. Some of the code will probably be obvious to you, and some of it may be a bit mysterious.

Experiment with the code, close the Visual Basic Editor, and run your macro again. See if something different happens this time!

Next step

How?

Quick start: create a macro (7)

Before recording a macro

be sure thatDevelopertab is visible on the ribbon. By default yesDevelopertab is not visible, do the following:

  1. Go toExcel>Preferences...>Ribbon and toolbar.

  2. I thinkCustomize the ribbonkategori, iMain tabslist, you must selectDevelopercheck box and then clickSavings.

Quick start: create a macro (8)

Record a macro

  1. Am working on itDevelopertab, clickRecord macro.

  2. Optionally enter a name for the macro iMacro nameenter a keyboard shortcut in the boxHotkeybox and descriptionDescriptionbox and then clickOkayto start recording.

  3. Perform the actions you want to automate, such as entering boilerplate text or filling a column with data.

  4. Am working on itDeveloperthe tab, iCodegroup, clickStop recording.

Quick start: create a macro (9)

Take a closer look at the macro

You can learn about the Visual Basic programming language by editing a macro.

To edit a macro, iDevelopertab, clickMacro's, select the macro name and clickEditing. Dette starter Visual Basic Editor.

See how the actions you recorded appear as code. Some of the code will probably be obvious to you, and some of it may be a bit mysterious.

Experiment with the code, close the Visual Basic Editor, and run your macro again. See if something different happens this time!

Do you need more help?

You can always ask an expert for helpExcel Tech Communityor receive supportCommunities.

Do you need more help?

Do you want more options?

Experience the community

Discover subscription benefits, browse courses, learn how to secure your device, and more.

Communities let you ask and answer questions, provide feedback, and listen to knowledgeable experts.

Quick start: create a macro (2024)
Top Articles
Latest Posts
Article information

Author: Kelle Weber

Last Updated:

Views: 6701

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Kelle Weber

Birthday: 2000-08-05

Address: 6796 Juan Square, Markfort, MN 58988

Phone: +8215934114615

Job: Hospitality Director

Hobby: tabletop games, Foreign language learning, Leather crafting, Horseback riding, Swimming, Knapping, Handball

Introduction: My name is Kelle Weber, I am a magnificent, enchanting, fair, joyous, light, determined, joyous person who loves writing and wants to share my knowledge and understanding with you.