Code execution was interrupted - Solution - Excel - MACRO VBA

Have you ever encountered this problem? It can be very annoying if it's recurring, if that's the case, don't worry, there are a few useful measures. It's a recurring problem within Excel and while it doesn't have a specific cause, there are some clues.

Something is clear, this happens when we use macros within Excel. When the error appears, the system cannot run the macro correctly, the warning is only an indication of an internal problem with the application.




The truth is that there are many problems that arise when using Excel, such as "Excel has found a problem that prevents it from working properly" and it is important to know how to fix them all so that they do not affect the use of the application, so you we show this guide for the 'code has been aborted' error.

What you need to know to understand the problem

This is a problem that can be caused by several reasons, but first you need to consider what its basis is.

What is a macro?

Macros are a feature present in many applications, in fact it is not something unique to Excel, as in many different applications we can access these functions.

Macros try to facilitate the development of activities within our PCs, for example it is possible to use macros to count cells with data, undoubtedly being a fundamental aspect of the software.

To summarize, a macro is described as rescue actions to be performed later. Macros are also defined as the repetition of complex actions, accessed with simple key combinations or through other methods.

This function is very useful, since through its use we can to repeat very easily complex functions. Something very practical when actions are performed on a recurring basis, such as creating a specific Excel table.




<a name=Code execution was interrupted - Solution - Excel - MACRO VBA" src="/images/posts/e76b0ecf6d9ecfc50d22962e74eb8637-0.jpg">

What causes the error code to stop running?

Unlike formula errors like "# DIV / 0! # N / A #VALUE "which can be easily corrected with this error, things change, since unfortunately does not exist a single cause that it face appear, in fact, is one of those problems that can have so many causes that it is not possible to define one in particular that causes the warning to appear.

However, there is a hypothesis that it may be due to unintentional use of a specific key combination. We refer to the key combination Ctrl and the button Pause.

This key combination is known to prevent macros from running, which is why this problem can occur pressing both keys unintentionally. In any case, this is only a possible cause and in fact it is unlikely, since the keys are too far apart to be accidentally pressed.

Code execution was interrupted - Solution - Excel - MACRO VBA

While this problem can be generated for many reasons, the truth is that we know when it occurs and it is precisely when let's run a macro. For this reason we can determine that the problem occurs specifically after its execution.

As mentioned above, the combination of the Ctrl + Pause keys could be the cause of the problem. Having understood this, we can disable its execution through the configuration of the problem macro.


  • Having correctly located the macro that produces the error, we will proceed to position ourselves on it and press the key combination Alt + F11.
  • When you press this combination, a code will appear on the screen, this is the macro code.
  • On the left you will find a small menu with several tabs. In this space is the modules option, under it you will see the module of your macro, which is usually called Module 1, although if you have multiple macros it is possible for several modules to appear.
  • After the Sub line, you will need to create a line with the following code: Application.EnableCancelKey: xlDisabled.
  • This should fix the problem if it related to the above. You can use it in each of the macros that have this problem.

<a name=Code execution was interrupted - Solution - Excel - MACRO VBA" src="/images/posts/e76b0ecf6d9ecfc50d22962e74eb8637-1.jpg">




The above method may not be the ultimate solution, but it has proven to be very efficient for many people. Remember that you will find this and other tutorials in Miracomosehace, a space for anyone who wants learn the easy way.

In any case, it is worth noting that one way to achieve stability is to update Microsoft Office 2016 to the latest version, as the company constantly fixes various errors or otherwise shows the solutions to users.


add a comment of Code execution was interrupted - Solution - Excel - MACRO VBA
Comment sent successfully! We will review it in the next few hours.