Macros are disabled by default in Excel for security reasons
Excel blocks macros automatically when you open a file, even if the file contains them. This is a safety feature — macros are small programs that run inside Excel, and a malicious macro could damage your computer or steal data. When you open a file with macros, Excel shows a yellow warning bar at the top asking whether you want to enable them. You have to say yes before the macros will work.
The steps to enable macros depend on where the warning bar appears and whether you trust the file. If you created the file yourself or received it from someone you trust, enabling macros is straightforward. If you are unsure about the source, it is safer to leave them disabled.
Key Takeaways
- Excel shows a yellow warning bar when you open a file containing macros, and you must click "Enable Content" to turn them on.
- Only enable macros in files you created yourself or received from a trusted source, because macros can run hidden code.
- If the warning bar does not appear, the file may not contain macros, or you may need to check your macro security settings in Excel options.
- You can also change your default macro security level in Excel settings if you work with macro-enabled files regularly.
Enable macros using the warning bar
When you open an Excel file that contains macros, a yellow bar appears below the ribbon at the top of the screen. The bar says "Security Warning" and explains that macros have been disabled. On the right side of this bar is a button labeled "Enable Content."
Click "Enable Content" to turn on the macros in that file. Excel will remember your choice for that specific file, so the next time you open it, the macros will run without showing the warning again. If you close the file without clicking "Enable Content," the macros remain disabled, but the file itself is not harmed.
Do not click "Enable Content" unless you recognize the file and trust where it came from. If someone sent you the file and you are not sure whether it is safe, contact them first and ask whether the file contains macros and why.
Change your macro security settings in Excel
If you work with macro-enabled files regularly and want to adjust how strictly Excel controls macros, you can change the security level. Open Excel and go to the File menu, then click Options. In the left sidebar, click "Trust Center," then click "Trust Center Settings."
In the Trust Center window, click "Macro Settings" on the left. You will see four options. "Disable all macros without notification" is the default and safest — macros are always off unless you enable them manually. "Disable all macros with notification" shows the yellow warning bar. "Disable all macros except digitally signed macros" allows macros that have a verified digital signature. "Enable all macros" turns on every macro automatically, which is the least safe option.
For most people, the default setting is the right choice. Change it only if you work in an environment where you regularly receive files with macros from trusted sources and want to reduce the number of times you have to click "Enable Content."
Add a file location to the trusted locations list
If you store macro-enabled files in a specific folder on your computer, you can add that folder to Excel's trusted locations. Files in trusted locations will run macros without showing the warning bar. Open Excel, go to File, then Options. Click "Trust Center," then "Trust Center Settings," then "Trusted Locations."
Click "Add new location" and browse to the folder where you keep your macro files. Check the box that says "Subfolders of this location are also trusted" if you want Excel to trust files in any subfolder inside that location too. Click OK to save.
Only add folders to trusted locations if you control who can put files in them. If the folder is shared with other people or connected to the internet, adding it to trusted locations creates a security risk.
Understand why Excel disables macros by default
Macros are powerful — they can read and write files, delete data, send emails, and run other programs on your computer. A malicious macro hidden inside an innocent-looking spreadsheet could do serious damage before you notice anything wrong. Excel disables macros by default to prevent this.
The yellow warning bar gives you a chance to decide whether you trust the file before the macro runs. If you do not recognize the file or do not know why it contains macros, leaving them disabled is the safer choice. Legitimate files will still work without macros — you just will not be able to use any features that depend on the macro code.
What to do if the warning bar does not appear
If you open a file and do not see the yellow warning bar, the file either does not contain macros, or you have already enabled macros for that file in the past. You can check whether a file contains macros by looking at its filename. Files with the extension .xlsm contain macros. Files with the extension .xlsx do not — they are regular spreadsheets without any macro code.
If you expected to see the warning bar and did not, check the file extension. If it ends in .xlsm and you still do not see the warning, the file may be in a trusted location or your macro security settings may be set to allow all macros. Review your Trust Center settings using the steps above to understand what is happening.
Frequently Asked Questions
Can I enable macros for all files from a specific person?
Excel does not have a way to trust all files from a specific sender. You can only trust individual files, folders on your computer, or files with valid digital signatures. If you regularly receive macro files from the same person, ask them to digitally sign their files, then set your macro security to allow digitally signed macros.
What happens if I enable macros in a file I should not have?
If you enabled macros in a file that turned out to be malicious, the damage depends on what the macro did. Run a full antivirus scan on your computer as soon as possible. If the macro sent emails or accessed sensitive files, change your passwords and monitor your accounts for suspicious activity.
Do I need to enable macros every time I open a file?
No. Once you click "Enable Content" for a specific file, Excel remembers that choice. The next time you open that same file, the macros will run without showing the warning bar. If you move the file to a different location, Excel may ask again.
Can I disable macros again after I enabled them?
You cannot undo enabling macros for a file you have already opened. However, you can prevent macros from running in the future by changing your macro security settings back to the default or by removing the file from your trusted locations list.
Why does my file have a .xlsm extension if I did not create macros?
Someone else may have added macros to the file before sending it to you, or the file may have been saved in macro-enabled format even though it does not contain any actual macro code. Check with whoever gave you the file to understand why it is in .xlsm format.