How to stop code execution has been interrupted error in Excel VBA.
My Excel VBA Keeps Breaking: A “code execution has been interrupted” keeps coming up, but my Code is Not “Broken”
So I have to share this handy trick. Sometimes when I’m running VBA code in Excel, it starts getting wonky. The Break/Debug window keeps popping up during execution, for no good reason. Code execution has been interrupted, over and over. The code has run perfectly fine in the past, perhaps hundreds of times. It’s almost as if something is stuck and hanging in the background. Restarting Excel does no good. It seems that the VBA interface itself needs a reset, but clicking reset does nothing.
When you receive the code execution has been interrupted pop-up, click Debug.
Then press Ctrl+Pause/Break twice.
Click on the Green Arrow or press F5 to resume.
You should be good to go, as long as there is nothing inherently wrong with your VBA code!
I’m not sure how or why this works,but it does. I think there may be some sort of bug in Excel, so hopefully it will be fixed at some point. I hope this helps you as much as it has helped me!
Comment below and let me know if there are other issues you would like me to solve!