Macros in Excel can make it easy to automate repetitive tasks and enhance productivity. However, sometimes, they refuse to run even when they are enabled. You may see errors or nothing happening.
Generally, this problem happens due to security settings, missing references, or errors in the macro code. Sometimes, conflicting add-ins or untrusted file locations can also block macros from working.
In this article, we will guide you through the most common reasons why macros don’t work and provide you with step-by-step instructions to fix each problem.
➤ Save your file as a Macro-Enabled Workbook for the macros to work.
➤ Ensure your macros are enabled in the Trust Center
➤ Move your workbook to a Trusted Location to avoid blocking of macros.
➤ Use the VBA Editor and fix any macro code errors.
➤ Disable conflicting add-ins or Personal Macro Workbook entries.
➤ Resolve the Missing References for the macros to work properly.
➤ Verify the macro’s Digital Signature and trust the certificate.
➤ Click “Enable Content” when Excel shows a security warning at the top of the worksheet.
Save the File in a Macro-Enabled Format (.xlsm)
If your Excel workbook containing macros is saved as a .xlsx file, the macros won’t work. Macros only work when the file is saved as a Macro-Enabled Format. So, you need to ensure your workbook is saved as an .xlsm file for the macros to work.
Steps:
➤ Go to your Excel File >> Save As
➤ Select Excel Macro-Enabled Workbook from the Save as type dropdown.
➤ Save the file.
Enable Content from the Security Warning
When you open a macro-enabled file, Excel may block macros for security reasons. If your Excel workbook contains macros and you see a yellow warning bar at the top of the worksheet, you need to enable content to allow the macros to run.
Steps:
➤ Open your macro-enabled Excel file.
➤ Click the Enable Content button on the bar to enable macros for that particular workbook.
Check Macro Settings
Excel has security settings that control the execution of macros. That is why sometimes, macros are disabled or restricted by default for security reasons. Hence, you need to ensure your macros are enabled in the Trust Center.
Steps:
➤ Open your Excel workbook.
➤ Go to File >> Options >> Trust Center >> Trust Center Settings…
➤ Select Macro Settings
➤ Choose Disable all macros with notification or Enable all macros >> Click OK.
Move the File to a Trusted Location
In case your file is opened from an untrusted folder, Excel may block macros from working even if it is enabled. So, you need to ensure that the location where your Excel workbook containing macros is added to a trusted location in Excel.
Steps:
➤ Go to File >> Options >> Trust Center >> Trust Center Settings.
➤ Select Trusted Locations >> Add new locations…
➤ In the new window, click Browse…
➤ Browse to the folder where your workbook is saved >> Click OK to save changes.
➤ Move your file to that location if it’s not already there.
Fix Macro Code Errors
Your macros won’t run if they contain any errors. Syntax errors, typos, unclosed loops, missing references, or logical mistakes can cause macros to fail. You will need to use the VBA editor to debug and correct any errors in your macro code.
Steps:
➤ Open your VBA editor by pressing Alt + F11 .
➤ Double-click the module containing your macro
➤ Check if there is any code highlighted red. If there are any, they are Syntax errors.
➤ Click Debug >> Compile VBAProject. It will help you find any hidden issues in your macros.
Disable Conflicting Add-ins or Personal Macro Workbook
Sometimes, other Excel add-ins or macros stored in the Personal Macro Workbook can conflict with your current macro. It may stop you enabled macros from working.
Steps:
➤ In your Excel workbook, go to File >> Options >> Add-ins >> Go…
➤ You will see a list of all add-ins that are installed.
➤ Uncheck any unused or suspicious add-ins >> Click OK.
➤ Press Alt + F11 to open the VBA Editor.
➤ Check the Project Explorer for PERSONAL.XLSB.
➤ If it contains any unwanted macros, remove them.
Resolve Missing References
You will not be able to run your macros until all missing references are resolved. This usually happens when a macro depends on a library or file that’s not available on your system.
Steps:
➤ Press Alt + F11 to open the VBA Editor
➤ Go to Tools >> References… in the VBA editor.
➤ Unresolved references are prefixed with MISSING in the References dialog box. Look for any items marked “MISSING:” in the list and Uncheck the missing reference.
➤ Use the Browse… dialog box to find the missing reference >> Click OK.
➤ Repeat the preceding steps until all missing references are resolved.
Verify the Digital Signature
If your macro-enabled workbook is digitally signed, it provides an extra level of security. If your Excel does not recognize or trust the signature, it may block the macro from working even if it is enabled. So, if your macro is digitally signed, ensure the certificate is trusted.
Steps:
➤ Open your macro-enabled workbook.
➤ Press Alt + F11 to open the VBA Editor.
➤ Go to Tools >> Digital Signature…
➤ If a certificate appears, click View Certificate. Ensure the certificate is valid and trusted.
➤ Click Choose… to add one if you need to add a certificate.
Frequently Asked Questions
How to activate macros for Excel?
Follow the steps below:
➤ Go to File >> Options >> Trust Center >> Trust Center Settings
➤ Choose the macro settings that fit your needs
➤ Click OK.
How to check if a macro is working?
Steps are below to check if a macro is working:
➤ Right click on the Navigation Pane >> Click Design View
➤ Go to Tools Group >> Macro Design >> Single Step >> Run
➤ The Macro Single Step dialog box will show information about the macro and the macro action, as well as the error number.
➤ Use Step to run actions one by one and check for errors
How do I reset macro settings in Excel?
Follow the steps below to reset macro settings in Excel:
➤ Go to File >> Options >> Trust Center
➤ Select Trust Center Setting >> Macro Settings
➤ Click the option you want in the Macro Settings Category under Macro Settings.
Wrapping Up
When macros don’t work even after enabling them, it’s often due to security settings, code errors, missing references, or file trust issues. You can fix most macro problems quickly and get your automation running smoothly by following the steps above. Feel free to download the sample file and share your thoughts and suggestions.