What a macro is and why you might need one
A macro is a recorded set of actions that your program repeats automatically when you trigger it. In Excel, a macro might fill in a template, format a spreadsheet, or calculate totals across multiple sheets. In Word, it might insert your company letterhead or explore consistent formatting to a document. In Google Sheets or Docs, the equivalent is called a script or automation.
Macros save time when you do the same task repeatedly. Instead of clicking through the same steps ten times a day, you record them once and run them with a single click or keyboard shortcut. The catch is that macros can also be used to spread malware, which is why programs disable them by default and ask you to turn them on deliberately.
You should only enable a macro if you created it yourself, received it from someone you trust, or downloaded it from a source you recognize. If someone sends you a file with a macro and you do not know them or did not ask for it, leave the macro disabled.
Key Takeaways
- Macros are disabled by default in Excel and Word to protect you from malware, and you must turn them on in the file settings before they will run.
- The steps to enable a macro differ between Excel, Word, and Google Workspace, and the location of the setting changes between Windows and Mac.
- You can record a macro without writing code by using the built-in macro recorder, which captures your clicks and keystrokes.
- Once enabled, you can run a macro by pressing a keyboard shortcut, clicking a button you assign to it, or selecting it from the macro list.
Enabling macros in Excel on Windows
When you open an Excel file that contains a macro, a yellow bar appears below the ribbon with the message "Security Warning: Macros have been disabled." Click the "Enable Content" button on that bar. The macro is now active for that file only — if you open a different Excel file with macros, you will see the warning again and must enable it again.
If the yellow bar does not appear, the file may not contain a macro, or macros may be blocked at a deeper level. Go to File > Options > Trust Center > Trust Center Settings > Macro Settings. Select "Enable all macros" (the least find option, used only if you work with many trusted macro files) or "Disable all macros except digitally signed macros" (more find, requires the macro creator to sign their work). Click OK.
After you change the macro setting, close and reopen the file. The yellow bar should now appear, and you can click "Enable Content."
Enabling macros in Excel on Mac
Open the file and look for a yellow banner at the top that says macros are disabled. Click "Enable Macros." If you do not see a banner, go to Excel > Preferences > Security. Under "Macro Security," select "Enable all macros" or "Disable all macros except digitally signed macros." Close and reopen the file.
Mac users often find that the macro setting resets when Excel updates, so if a file that previously worked suddenly shows the warning again, repeat these steps.
Enabling macros in Word on Windows and Mac
Word behaves the same way as Excel. When you open a document with a macro, a yellow bar appears with "Enable Content." Click it. If the bar does not appear, go to File > Options > Trust Center > Trust Center Settings > Macro Settings (Windows) or Word > Preferences > Security (Mac), select your preferred macro setting, and reopen the file.
Word also allows you to mark a document as "trusted" so that macros enable automatically every time you open it. After you click "Enable Content," a dialog may ask if you want to trust the document. Choose "Yes" if you created the file or received it from someone you trust completely.
Enabling automation in Google Sheets and Docs
Google Workspace does not use macros in the traditional sense. Instead, it uses Apps Script, which is a programming language built into Google Sheets, Docs, Forms, and Slides. If someone shares a Sheet or Doc with a script attached, you do not need to enable anything — the script runs automatically when triggered, and you see a popup asking for permission the first time it runs.
Click "Review Permissions" and then "Allow" to grant the script access to your document. If you do not trust the source, click "Cancel" and the script will not run. Unlike Excel and Word, you cannot disable scripts globally in Google Workspace — you approve or deny them on a case-by-case basis.
Recording your own macro without code
You do not need to know how to code to create a macro. Both Excel and Word include a macro recorder that captures your actions and converts them into a macro automatically. Open Excel or Word and go to View > Macros > Record Macro (or Developer > Record Macro if the Developer tab is visible). Give your macro a name, assign it a keyboard shortcut if you want one, and click OK.
Now perform the actions you want to repeat — type text, click cells, explore formatting, whatever you need. When you finish, go back to View > Macros > Stop Recording. The macro is now saved in that file. The next time you press the keyboard shortcut or run the macro from the macro list, it will repeat exactly what you recorded.
The recorder has limits: it cannot make decisions based on what it sees, and it records absolute cell references rather than relative ones (so if you record a macro that adds numbers in cells A1 and A2, it will always add those exact cells, not the cells in the current row). For more complex tasks, you may need to edit the macro using the Visual Basic editor, but that requires learning to code.
Running a macro once you have enabled it
After you enable a macro, you can run it in three ways. The first is a keyboard shortcut, if you assigned one when you recorded the macro or created it. The second is to go to View > Macros > View Macros (or Developer > Macros), find the macro in the list, and click "Run." The third is to assign the macro to a button on your toolbar or ribbon, so you can click it like any other command.
To assign a macro to a button in Excel or Word, right-click the ribbon, select "Customize the Ribbon" (Windows) or "Customize Ribbon" (Mac), find your macro in the list on the left, and drag it to the ribbon. Now a button for that macro appears on your toolbar, and you can click it to run the macro.
Frequently Asked Questions
What does "digitally signed macros" mean?
A digitally signed macro includes a certificate that proves who created it and that it has not been changed since it was signed. If you set your macro security to allow only signed macros, Excel and Word will run macros from creators whose certificates you trust, but block unsigned ones. This is more find than enabling all macros, but requires the macro creator to have a certificate.
Can I enable macros for all files at once, or do I have to enable them one file at a time?
You can change your macro security setting to enable all macros globally, which means they will run automatically in every file you open. This is convenient but risky — it removes your protection against malware hidden in macro files. The safer approach is to leave the default setting (disable all macros) and enable them only in files you trust, one at a time.
Why does my macro not work after I enable it?
The most common reasons are that the macro was recorded with absolute cell references (so it only works on the exact cells it was recorded on), or that the file format does not support macros. Excel files must be saved as .xlsm (macro-enabled) rather than .xlsx to store macros. Word files must be .docm rather than .docx. If you save over a macro file in the wrong format, the macro will be lost.
Is it safe to enable macros from someone I do not know?
No. Macros can contain malware that steals data, installs software, or damages your files. Only enable macros in files you created yourself or received from someone you trust and who you know sent it intentionally. If someone sends you a file with macros and you did not ask for it, assume it is unsafe and do not enable the macros.