How to Create Macros in Excel

Creating macros in Microsoft Excel is a great way to speed up repetitive work or to automate complex processes. For simple tasks, recording a macro is quick and easy. Even advanced functions can be handled by macros built with Microsoft Visual Basic for Applications (VBA) in the Visual Basic Editor.

graphics and charts
Tools in Microsoft Excel aid in organizing and presenting data.
credit: Jorge Juan Pérez Suárez/iStock/Getty Images

Record a Macro

Click the "Record Macro" button in the bottom-left corner of the Excel window, in the status bar. A dialog will give you the chance to name your macro and assign it a shortcut key. After clicking "OK," your actions will be recorded into the new macro so they can be replayed later.

While recording, the "Record Macro" button will change to a "Stop Recording" square. Click that button when you are done to save your macro.

Use the Visual Basic Editor

Click the "View" tab on the Ribbon. Click on "Macros," and from that drop-down menu, choose "View Macros." You may either edit an existing macro that you recorded, or enter a new macro name to click "Create." The Visual Basic Editor will open, allowing you to create more powerful macros using VBA.

Advanced Options

Enable the "Developer" Ribbon tab by clicking "File," then choosing "Options" and finally "Customize Ribbon." In the "Main Tabs" list on the right, select the "Developer" check box and click "OK." This gives you easy Ribbon access to macro security options, form controls and more.