I first came across this Microsoft Excel vba error back in 2009, when the vba dialog box interrupted 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 doesn’t have an error number and in fact it isn’t really an error but rather a bug for which a lot of misinformation existed on the net back then.
The Problem defined.
You’ve written your Excel VBA application and everything’s 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.

Maybe it’s a one off and you run the code again, but the message "Code Execution Has Been Interrupted" appears 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 couldn’t 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 doesn’t clear the breakpoint out of it’s "memory".
So the breakpoint somehow gets hardcoded into your vba module within the file even though there’s 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’ll 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’ve 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 doesn’t solve the problem and in fact ensures that you cannot "Break" into the application if something goes wrong.
This seems to work. Thanks
HI Geoff
Glad I could help.
worked
Silly bug but thanks a lot for saving me headache.
Thank you very much!!! It really helps! You are a Great Guru!
How do you succeed to find out this solution?
Tanks for this simple solution. This problem still ocuurs in excel vba 2016 Dutch version.
This worked for me – thank you!
Worked for me. Thank you
Yes, It worked for me.
Thank you so much
Thanks
It worked for me
Thanks Hema, Dev, Adam and Greg for the reply.
Glad to know that this article is useful.
Cheers
Sean
It worked for me too.
Thank you π
SHORT AND PROFESSIONAL.
Thanks a lot.
very nice article wonderful
Thanks Sean! This was a great help.
Glad I could help, Gulam.
It caused me a lot of pain, back in the day.
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.
holy cow! i’ve been looking for an answer to this pesky problem. this made my day. thanks so much Sean! π
I know how you feel, it totally ruined my month back in the day.
I was pulling my hair out, thank you for saving me a lot of work.
Whaaawww! This is great! Till now I had to reboot to get rid of this message. Thanks a lot.
Thank you, this worked for me. Solved!
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 π
Worked like a charm. Thank You
Thank you, worked great
Great, Good solution, this is what I was looking for.
Many thanks.
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
Thank you
Worked efficiently. Thanks
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 !
if the issue comes back over and over again try to set the application.calculation to xlcalculationmanual at the beginning of the line then set back to automatic to the last line of the code. I dont know how to explain this but it works.
Worked, Thx again.
THANKS A LOT. it works for me
You saved my life, thanks for sharing the solution to this weird mystery show stopper!
Thanks for this info
This solution worked as charm thank you
Hi Sean,
That work for me too. Thanks a lot.
But I do not know how the hidden break point was added into my code since the last time everything work well. Could you or anyone tell me the reason then I can avoid next time?
Thanks,
Thank YOU! – I had just a small panic attack as I was ready to deploy when this popped up!
A question here, if it’s something related to the breakpoints previously used in the vba environnement it shouldn’t be enought to copy the code and paste it in a new workbook to bypass the problem?
I’ve done that but the problem persists… any idea?
TY so much.
ItΒ΄s a perfect article and it works. Thank you so much.
Thanks! Perfect!
Just had to use this while up against a deadline. Thank you!!!!
Thank you very much. It works like a charm.
Thank you. I have battling this problem for some time now. Restarting Excel never did the trick so I always ended up rebooting.
Thanks, its excellent. have problem: excel memory increase and going maximum level in memory, how to reduce or refresh it !!
Yes, this worked and was a huge help. Thank you very much!
OR open VBA editor, select ->debug->clear all breakpoints.
Excelent, this work for me. Thx
You ledgend Sean.
I just had this exact problem at the end of an important production and I thought “WHAT!”
Will add that I had made a stupid error just beforehand where I forgot to reset a loop counter so crashed my code – I suppose that excel couldn’t clear the breakpoints on the recovered file.
Anyway thank you for bothering to share this online. It would have been very distressing to have my code constantly interrupted by the debugger.
Thank you so much Sean Johnson for this information.
I had made a macro couple of weeks back (I am still learning to create macros) tested and was working fine
In the start of this week I thought of just re-checking it to take some reference from it to write a new macro code and suddenly it started giving errors. I was confused why properly tested code giving errors and I thought I made some mistakes in the line and started trouble shooting the code instead of looking for why I was getting interrupted error. And sometimes the macro used to stop any random line which was more frustrating because the code never used to stop at the same line it used to be any random lines
From last 1 week I have been searching like crazy and changed my code so many times to make it work and couldn’t find the solution.
Finally your resolution helped and my code is running perfectly now. I just did Ctrl + Break 10-15 times as you suggested and now all problems resolved thanks to you.
Please let me know if you can help me get the complete start to end book of learning macro or videos that will be really helpful I am still learning but the video I have seems doesn’t have such trouble shooting tips
Thank you so much
Cheers,
Thanks!
I spent hours trying to solve this one.
Thanks for the solution. It was interesting, yesterday I had that happen in the code of my spreadsheet. Today I opened another spreadsheeet and the same thing happened. So its not just limited to the spreadsheet that it first happened in. It looks like Excel is carrying that into all the spreadsheets until the magical CTRL-Break method fixes it for all!
Glad I could help
So happy I found this page instantly when searching. Can see where I could have spent many, many frustrating hours / days finding such / debugging
Thank you!
Sean, thanks a lot for your advice.
I was thinking there is an error in my code, but it was a bug as you explained.
It works! and I didn’t think it would.
It worked thanks!
This works. Thank You
De Mucha Ayuda
Gracias
Thank you very much! You saved me ton of aggravation…..Kudos!
Been here before…back again today…hidden break point in code…wreaking havoc on a more or less happy day of VBA programming on Friday 13th! …oh no!! Microsoft is making me tear my last hairs out…every macro…says code execution has stopped!! what?? same code as before…but the gremlins have arrived!! Thanks for putting the gremlins back out of sight…and the world to peace again…:)
Gotta, whack those gremlins π
thank you … it worked for me
Excellent, thank you so much! I had something similar in MS Access VBA, but I didn’t realize that same can happen in Excel.
Glad I could help
While this is an old post it is still a live saver! Thanks for writing it. Makes my scripts run just fine again.
I guess the old posts are still relevant since MS isn’t doing much updating on VBA.
that work me me as well!! Thank you!!! π
You’re welcome Marco
And it still works in 2020 π
Thank you!
Thanks for letting me know Fabio.
Thanks, Sean! Your tip has just saved me a lot of aggravation. MS Word, not MS Excel.
I can’t believe I spent so many years resetting my computer when the error would popup. Your fix is so simple. Thank you!
You’re welcome
Thanks Sean.
You’re welcome
Thanks man, I was at odds with my code
Glad I could help
This article saved my day. Thank you so much :O)
You’re welcome Erik
Thanks Sean. So simple but very helpful.
Glad It worked out for you.
Thank you Sean! very helpful π
Thanks, Omar
Microsoft doesn’t seem to be interested in fixing this bug, given I came across it over 10 years ago.
Hello sean. thank you for saving my day
at first i thought this issue was caused by my windows or excel
thank you for the solution
You’re welcome, Ramana
it works for me too
Great
This has been plaguing me for years! Thank you SO much!!
You’re welcome Jude
Glad I could help, Jude. (Not going to say hey, no waaay….)
THANK YOU!
You’re welcome
Million thanks from China.
You saved my hair today:)
Merry Christmas.
Glad I could help, UK China relations by providing a great hair product π
This just happened to me. Great fix. Thanks!
wow, was a really easy fix. thanks.
Yes this sill works as of May 2021. FYI this worked even when the Application.EnableCancelKey = xlDisabled did not.
Yes Mark
Application.EnableCancelKey = xlDisabled, is no use for this problem
Thanks π
Wow what an annoying bug! Your solution worked first time so thank you π
Yes it really is, not sure If MIcrosoft have fixed it yet
Take the day off! You’re great…!
Where should I go?
Fantastic!!
It sure is.
YouΒ΄re my hero
Glad I could help
This seemed to work.
It happened to me for the first time today.
So it appears that M$ has not fixed it yet.
This interruption could be a show stopper if it persists in a spreadsheet deployed for use by others.
They can be quick to throw out the baby with the bath water if they can point to anything and declare, “It doesn’t work.”
I doubt that M$ will fix it.
They are starting to embrace Python.
I suspect this will mean the end of VBA in a future “update” of Excel — and M$ will leave yet more permanently broken software in their wake.
I don’t see VBA going away any time soon, too many corporate spreadsheets will stop working, but yes in the future they may prioritise javascript or python.
Saved me!!!
It really works!
Thank you very much!
Thanks. Nice work!