In this article, Mytour will guide you on how to create a simple macro for your Excel worksheet.
Steps
Enable Macros

Open Excel. The steps are the same for Excel 2010, 2013, and 2016, with only slight differences in Excel for Mac. These differences will be explained in detail below.

Click on the File tab.
- For Excel on Mac, click the "Excel" menu.

Click on the Options (Settings).
- For Excel on Mac, click the "Preferences" menu.

Go to the Customize Ribbon (Ribbon Customization) option.
- For Excel on Mac, click on "Ribbon & Toolbar" under the "Authoring" section.

Check the box for Developer on the right-hand list.
- For Excel on Mac, the "Developer" option can be found under the "Tab or Group Title" section.

Select OK. The Developer tab will now appear at the end of your tab list.
Record Macro

Practice with the steps in your macro. When recording a macro, every action or click you make will be captured. This means even the smallest mistake can lead to everything going wrong. So, take some time to practice the commands you intend to record, so you can execute them confidently and accurately when it matters.

Open the Developer tab.

Click on Record Macro to start recording a new macro. This option is found under the Code section of the ribbon. You can also use the keyboard shortcut Alt+T+M+R (Windows OS only) to begin.

Assign a name to your macro. Choose a name that is easy to recognize, especially if you plan on creating multiple macros.
- You can also add a description to explain what the macro does.

Click on the Shortcut key field. You can assign a shortcut key to your macro for easier operation. Note that this step is optional.

Press ⇧ Shift along with a letter. The key combination Ctrl+⇧ Shift+letter will be used to activate the macro you are setting up.
- On Mac, the combination will be ⌥ Opt+⌘ Command+letter.

Click on the Store macro in menu.

Click on the location where you'd like to save your macro. If you want the macro to be available only in the current workbook, simply choose "This Workbook". If you'd like it to be available in any workbook, select "Personal Macro Workbook".

Click on OK. Your macro will now begin recording.

Perform the actions you want to record. Almost everything you do at this point will be recorded and added to the macro. For example, if at cell C7 you run a formula that sums A2 and B2, later, when you run the macro, the sum of A2 and B2 will always be calculated and displayed in C7.
- Macros can become quite complex. You could even use them to open other Office programs. When recording a macro, almost everything you do in Excel is included.

Click Stop Recording when you're done. The macro recording will stop and your macro will be saved.

Save the file in a macro-enabled format. To retain the macro, you must save the workbook in a special Excel format that supports macros:
- Click on the File menu and select Save.
- Click the File Type menu located under the filename field.
- Select Excel Macro-Enabled Workbook.
Using Macros

Open the Excel file that contains your macro. If the file was closed before running the macro, you will be prompted to enable its content.

Click the Enable Content option. Every time a macro-enabled Excel file is opened, this option will appear at the top of the spreadsheet, under the Security Warning message bar. Since this is your file, you can safely enable it. However, always be cautious when opening macro-enabled files from any external source.

Press your macro's shortcut key. When you want to use your macro, you can quickly run it by pressing the shortcut key you assigned to it.

Click the Macros button on the Developer tab. All the available macros in the current worksheet will be displayed.

Click the macro you want to run.

Click the Run button. The macro will execute on the current cell or the selected cells.

View the code of a macro. If you want to learn more about how macro code works, you can open the code of any macro you have created and experiment with it:
- Click the Macros button on the Developer tab.
- Select the macro you want to view.
- Click the Edit button.
- View the macro code in the Visual Basic code editor window.