Code Execution Has Been Interrupted – The best fix to this Excel VBA Problem

I first came across this Microsoft Excel vba error back in 2009, when the vba dialog box interupted macro processing with the message "Code Execution Has Been Interrupted" and it quite literally did my head in.

It’s a weird error because it does not have an error number and in fact it is not really an error but rather a bug for which a lot of misinformation existed on the net back then.

The Problem defined.

You have written your Excel VBA application and everything is working fine, then for no apparent reason the following dialog box pops up, you click "Debug" on the dialog box but you cannot find anything wrong with your code.

Code Execution Has Been Interrupted

Maybe it was a one off and you run the code again, but the message "Code Execution Has Been Interrupted" occurs again, oops!

When that happened to me, after a lot of research on the net, I thought I was up a certain creek without a paddle.

Since my application was going to be deployed to my user base, I could not have something as unprofessional as this dialog box popping up randomly.

The code would go into break mode at various parts of the program even though no "break points" or "STOP" commands existed on those lines.

What I think Causes It

I can only guess at this, not being a Microsoft Insider, but it seems to me that when you set breakpoints in your code, either by using the "STOP" command or clicking the left sidebar of the code or hitting "ctrl" + "break" to enter break mode during your development process, Microsoft Excel sometimes records this "behind the scenes" and does not clear the breakpoint out of it’s "memory".

So the breakpoint somehow gets hardcoded into your vba module within the file even though there is no visible breakpoint in your visual basic editor.

The Solution – Clear the hidden break in the code with another "Ctrl + Break"

So when this happens to you, click "Debug" on the Microsoft VBA "Code Execution Interrupted" dialog box, this will jump you to the Visual Basic Editor and a particular line of code will be highlighted to show that execution has stopped at that point.

As the compiled vba code in the workbook probably has a hidden breakpoint saved at this point, just hit "Ctrl + Break" on your keyboard (I tend to do Ctrl+Break multiple times).

Sign up below and get notified when new Business Programmer blog or video tutorials are created.

This removes the hidden breakpoint and all you need to do now is save the workbook and your problem is solved, at least for that breakpoint.

If this problem does occur again, most likely you have multiple hidden breakpoints in your application.

Just rinse and repeat the above instructions for each instance of "Code Execution Interrupted" until the problem is solved.

Note do not use Application.EnableCancelKey = xlDisabled as this does not solve the problem and in fact ensures that you cannot "Break" into the application if something goes wrong.

If you found this article helpful then why not leave comment and or share it using one of the social media buttons below.

Thanks for reading this post

If you have any queries or comments please leave them below as they help to improve the quality of the information that I provide.

If you found this article useful then don't forget to share it by clicking on one of the social media buttons below.


  1. Geoff Mitchell

    March 19, 2016 at 8:23 pm

    This seems to work. Thanks

    • Sean Johnson

      March 19, 2016 at 9:18 pm

      HI Geoff

      Glad I could help.

  2. Greg Moran

    June 16, 2016 at 4:54 pm

    This worked for me – thank you!

  3. Adam

    June 29, 2016 at 11:59 am

    Worked for me. Thank you

  4. Dev

    July 14, 2016 at 4:27 pm

    Yes, It worked for me.

    Thank you so much

  5. Hema Packiriswamy

    August 19, 2016 at 6:46 am

    It worked for me

    • Sean Johnson

      August 19, 2016 at 7:11 am

      Thanks Hema, Dev, Adam and Greg for the reply.

      Glad to know that this article is useful.



  6. Dorota

    October 11, 2016 at 12:51 pm

    It worked for me too.
    Thank you 🙂

  7. Edward

    October 14, 2016 at 10:39 pm

    Thanks a lot.

  8. Imran Khan

    November 18, 2016 at 12:54 pm

    very nice article wonderful

  9. Gulam M Shoeb

    November 24, 2016 at 11:08 am

    Thanks Sean! This was a great help.

    • Sean Johnson

      November 25, 2016 at 7:49 pm

      Glad I could help, Gulam.
      It caused me a lot of pain, back in the day.

  10. Milind

    December 15, 2016 at 8:33 am

    Thanks a lot, Sean! This trick solved the problem instantly.

    I agree that intervention such as the code “Application.EnableCancelKey = xlDisabled” is over doing it a bit.

    Minimal solutions work the best.

    Thanks a lot.

  11. Migs

    December 20, 2016 at 11:11 pm

    holy cow! i’ve been looking for an answer to this pesky problem. this made my day. thanks so much Sean! 🙂

    • Sean Johnson

      December 21, 2016 at 12:18 am

      I know how you feel, it totally ruined my month back in the day.

  12. Lisa

    June 16, 2017 at 4:04 pm

    I was pulling my hair out, thank you for saving me a lot of work.

  13. Patrick

    August 3, 2017 at 8:07 am

    Whaaawww! This is great! Till now I had to reboot to get rid of this message. Thanks a lot.

  14. Fiona

    August 17, 2017 at 11:21 am

    Thank you, this worked for me. Solved!

  15. Chris

    August 31, 2017 at 8:59 pm

    Excellent solution, and good point about misinformation around this issue. Excel is not my forte’ but I could lend a hand if you need any database queries written 🙂

  16. Floyd

    November 22, 2017 at 1:11 pm

    Worked like a charm. Thank You

  17. Jessica

    December 7, 2017 at 2:21 pm

    Thank you, worked great

  18. Franklin

    December 29, 2017 at 5:21 am

    Great, Good solution, this is what I was looking for.

    Many thanks.

  19. Solution seeker

    January 7, 2018 at 8:20 am

    Hi this is Yaried I’ve an excel template constructed with vba program, and it works only in registered computers, this means it automatically closes when someone tries to open in unregistered computer. But I’ve suffered a problem, that they open it with applying ctrl + break to terminate auto execution. Is there some one to help with this problem

  20. Siddartha

    January 9, 2018 at 9:40 am

    Thank you

  21. Sandy

    February 5, 2018 at 3:10 pm

    Worked efficiently. Thanks

  22. Thomas

    February 7, 2018 at 11:15 am

    THANK YOU – I can’t believe there are bugs like this still hanging around !!!

    It’s working now. Maybe Compile VBAProject would have fixed it. Too late for me to check, it’s already working now.

    Coffee / Beer on me if you’re anywhere near St Pauls !

Leave a Reply

Your email address will not be published. Required fields are marked *