In Excel for Microsoft 365 on Windows, select Developer > Code > Record Macro, set the macro’s name and storage location, then select OK. Excel starts recording immediately, so perform the actions you want to capture and choose Developer > Code > Stop Recording when you are finished.
Show the Developer tab if it is missing
The Developer tab is where Excel puts the main macro-recording controls, but it is hidden by default in many installations. You only need to show it once for your Excel setup; enabling the tab does not turn on macros or start a recording.
- Select File > Options.
- Choose Customize Ribbon.
- Under Main Tabs on the right, check Developer.
- Select OK. The Developer tab should now appear on the ribbon.
To begin a recording, open the Developer tab, find the Code group, and select Record Macro. If the tab is already visible, you can skip the setup. The View > Macros menu also provides macro-related commands in Excel for Windows, but Developer is the clearest route when you are learning the recorder.
What the macro recorder does
The recorder observes many actions you carry out in Excel and translates them into Visual Basic for Applications (VBA) instructions. For example, selecting a range, applying a number format, entering a formula, and adjusting a column width can become steps in a macro. Later, you can run that macro to repeat the recorded sequence.
Think of it as a way to capture repeatable work, not as a recording of everything on your screen. It does not save mouse movements or make a video. It records supported Excel commands and choices, and some actions may be represented in a more general way than the exact clicks you made. The resulting VBA can be viewed and edited in the Visual Basic Editor, but you do not need to write code to make a basic recording.
A useful first project is formatting a recurring report: apply a heading style, set date and currency formats, make columns readable, and add a total. A recorded macro can repeat those operations on another sheet, provided the layout and starting point are suitable.
Choose a name, shortcut, and storage location
After you select Record Macro, Excel opens a dialog. It is worth deciding where the recording belongs before you press OK, because that choice affects which workbooks can use it.
- Macro name: Enter a descriptive name such as FormatMonthlyReport. Macro names cannot contain spaces, so use underscores or capital letters to make a name readable. Begin with a letter.
- Shortcut key: You can assign a keyboard shortcut, but this is optional. A shortcut can replace an existing Excel shortcut while the workbook containing the macro is open, so choose a combination carefully and consider using Ctrl+Shift with a letter.
- Store macro in: Choose This Workbook to keep the macro with the current file, Personal Macro Workbook to make it available when you use Excel on that computer, or New Workbook to place it in a separate workbook.
- Description: Add a short note about what the macro does if you may need to identify or maintain it later.
For a macro intended to travel with a particular report, This Workbook is usually the straightforward choice. The Personal Macro Workbook is useful for personal tools you want available across workbooks on the same computer. It is normally hidden while Excel is open, and it is not automatically carried to another person’s computer when you send them an ordinary workbook.
Decide whether references should be relative
One important recorder setting is Use Relative References, found on the Developer tab in the Code group. When it is off, Excel generally records many cell selections and destinations as fixed references. When it is on, the recorded actions can be relative to the cell that was active when recording began. Set the option before recording, because it changes how the recorder interprets the actions that follow.
For example, suppose you want to format the cells immediately to the right of whichever cell is selected. A relative recording can capture the movement from the starting cell to its neighbor, which may make the macro useful at different positions. With fixed references, the same recorded sequence may keep returning to the original address, such as B2, even when you start elsewhere.
Relative recording is not a universal fix. It is helpful for repeatable patterns that move through a sheet, while fixed references can be suitable when the macro should always work on a known layout. Before relying on either approach, run the macro on a test copy and confirm that it acts on the intended cells.
Record, stop, and save the macro
Once you select OK in the Record Macro dialog, recording begins immediately. Carry out only the actions you intend the macro to repeat. Avoid unrelated clicks or changes, since they may also be captured and become part of the sequence.
When finished, select Developer > Code > Stop Recording. Do not just close the workbook and assume Excel will treat that as a clean end to the recording. You can then inspect the macro through Developer > Code > Macros, select its name, and choose Edit to open its VBA code, or choose Run to execute it.
If you stored the macro in the current workbook, save that file as an Excel Macro-Enabled Workbook (.xlsm) to retain the VBA macro. A standard .xlsx workbook does not store VBA macro code; if you save a macro-enabled workbook in that format, Excel warns that the macro will be removed. The Personal Macro Workbook is saved separately from the workbook you are editing, so follow Excel’s prompt to save changes to it when you close Excel.
What it records—and where it has limits
The recorder is most useful for straightforward, consistent tasks performed through Excel’s interface: formatting cells, entering values or formulas, applying filters, and repeating certain worksheet operations. It can create VBA instructions for supported actions without requiring you to know the language beforehand.
It does not reliably turn every workflow into a flexible, polished tool. A recording may depend on the active sheet, selected range, or workbook layout at the time it was made. If a new report has extra rows or columns, a macro that targeted a fixed range may miss them. The recorder also cannot capture work done in another application as Excel actions, and a recorded sequence may need editing to handle changing data, decisions, or errors.
That does not make a recording useless: it can provide a starting point. A person comfortable with VBA can inspect the generated code and adjust it, while a beginner can keep the task simple and test the macro on copies of representative files. Excel macros cannot be undone with Ctrl+Z, so save a copy of the workbook before running a macro, especially one you did not create or have not checked.
Recorder access is not the same as enabling macros
There are two different questions that are often confused: how to turn on the recorder, and how to allow a workbook’s macros to run. The Developer tab and Record Macro command concern creating a macro. Macro security controls whether Excel permits VBA code in a workbook to execute. Showing the Developer tab does not lower security settings or make a downloaded macro safe.
Excel’s security features may block macros in files from untrusted sources. Do not enable code just because a workbook displays a warning or because someone says it is required; only allow macros from a source you trust and when you understand why the workbook needs them. An organization may also manage these settings, so some options can be unavailable. The Trust Center settings are under File > Options > Trust Center > Trust Center Settings > Macro Settings, but changing them broadly to allow all macros is not a sensible way to make the recorder work.
Excel for Mac and Excel for the web
Excel for Mac also supports VBA macros and a macro recorder. The ribbon may look different, but you can use the Developer tab’s Record Macro command. If Developer is hidden, open Excel > Settings (called Preferences in some older releases), go to Ribbon & Toolbar, and enable Developer under the main tabs. The precise dialog layout and some available options can differ from Windows.
Excel for the web does not record, run, or edit VBA macros. You can open some macro-enabled workbooks in the browser, but VBA will not run there. If you need browser-based automation, Office Scripts may be available through the Automate tab for your account and environment. Office Scripts are a different automation feature, not a way to turn on Excel’s VBA macro recorder.
Frequently Asked Questions
Why can’t I see Record Macro in Excel?
First check whether the Developer tab is hidden. In Windows Excel, enable it at File > Options > Customize Ribbon by checking Developer. If you are using Excel for the web, VBA recording is not supported there; open the workbook in the desktop app.
Does clicking Record Macro start recording right away?
Yes. After you complete the dialog and select OK, Excel begins capturing supported actions. Stop it from Developer > Code > Stop Recording when the intended sequence is complete.
How do I record a macro that works on different rows?
Consider turning on Developer > Code > Use Relative References before recording if the steps should follow the active cell. Test the result from more than one starting position; relative references do not automatically make every macro adapt to changing data sizes.
Why did my macro disappear after I saved?
Check the file type. Macros stored in a workbook require a macro-enabled format such as .xlsm; saving as .xlsx removes VBA code. If you chose Personal Macro Workbook, the macro is stored separately rather than inside the workbook you were editing.
Can I undo a macro with Ctrl+Z?
No. Running a VBA macro clears Excel’s normal undo history, so Ctrl+Z cannot reverse its changes. Save a separate copy before running a macro, and test unfamiliar code on a disposable copy first.
Related
- Excel Shortcut Keys for Switching Between Worksheets
- Excel Shortcut Keys for the Next Sheet in a Workbook
- Excel Named Range Data Validation List: Setup and Fixes
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- Excel VBA: Find the First Row Above a Value ThresholdTo find the first row where a cell’s value is greater than a threshold, loop through the relevant…
- Excel VBA: How to Check Whether a Workbook Is OpenTo check whether a workbook is open in Excel VBA, loop through Application.Workbooks and compare each open workbook’s…
- Excel VBA Range Using Cells: Syntax, Examples, and TipsIn Excel VBA, use Cells(row, column) to identify a cell by its row and column numbers, and pass…
- Google Sheets Macros: How They Work and When to Use ThemYes, you can use macros in Google Sheets in a web browser. Record a sequence of spreadsheet actions…
- How to Put a Photo in a VBA UserFormTo put a photo in an Excel VBA UserForm, add an Image control, then either set its Picture…
- Excel VBA Format: Format Cells, Dates, and NumbersIn Excel VBA, “format” can mean either converting a value to display text with the Format function or…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.