Excel Guides

Macro Fails after AutoFilter in Excel

If you're experiencing an issue with your macro failing after using the AutoFilter function in Excel, there are a few things you can try to troubleshoot the problem.

First, check your macro code for any errors

When you run into an issue with your macro code, the first thing you should always do is check for any errors. If there are any syntax errors or other problems with your code, the macro will usually fail when it reaches that point. To check your code for errors:

  1. Open the Visual Basic Editor by pressing Alt+F11
  2. Click on Debug > Compile VBAProject

If there are any errors in your code, they will be listed in the Compile Error window. Fix any errors that are listed and try running your macro again.

Next, try running your macro in a new workbook

Sometimes, the issue can be caused by something in the workbook that's causing problems. To rule this out, try running your macro in a new, blank workbook. If it works fine in a new workbook, then there's probably something wrong with the original workbook that's causing the problem.

Finally, make sure AutoFilter is turned off before running your macro

If AutoFilter is turned on when your macro runs, it can cause problems. To make sure AutoFilter is turned off before running your macro:

  1. Open the workbook that contains your macro.
  2. Press Alt+F8
  3. "Uncheck" the box next to "AutoFilter"

(If "AutoFilter" isn't listed as an option, then it's already turned off and you don't need to worry about this.)

Once you've tried all of these troubleshooting steps, hopefully your macro will start working correctly again!

Move beyond 


Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.