Stop a Macro from Running in Excel

Add to Favorites
Author: | Edits: don

How to stop a macro from running after it has started.

This method uses the keyboard and has nothing to do with the programming of the macro.

If the Macro is simply in a continuous loop or is running for too long you can use one of these keyboard shortcuts to kill it:

Esc hit the Escape key.

Ctrl + Break hit Ctrl key and then the break key, which is also the pause key. On some keyboards you may have to use another key if the break or pause key doesn't exist; this is particularly true if you are using a laptop; in that case, you will need to find out what the break or pause key is on your keyboard.

Ctrl + Alt + Del If Excel freezes and you can't do anything, you can either wait a long time, maybe the macro just needs some time, or hit Ctrl + Alt + Del, go to the Task Manager, go to the Applications tab, and select the Excel application and hit the button End Task.

When you use Esc or Ctrl + Break to end the execution of the macro, you will see this window:

be96dbb576e53adfcda7d98a521c7528.png

Hit End to stop the macro from running and return to Excel.

Hit Debug to go to the macro in the VBA editor window and see where the code stopped in an effort to fix the problem.

Hit Continue to continue the execution of the macro.

Notes

Download the Excel workbook that accompanies this tutorial if you want a simple macro that will loop forever until you cancel it. This way you can test this situation in Excel.

Here is the simple macro I used to test this:

974da08a691f56430812c1c06aeaf1f9.png


Downloadable Files: Excel File

Question? Ask it in our Excel Forum


Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Similar Content on TeachExcel
Run a Macro at Set Intervals in Excel
Tutorial: Run a macro every 30 seconds, 1 minute, 10 minutes, 1 hour, etc.; this method allows you t...
Run a Macro When you Click a Button in Excel
Tutorial: Make a macro run when you click a button in the worksheet in Excel. This allows you to cr...
Prevent Charts from Printing in Excel
Tutorial: This is how you prevent a chart from appearing when you print from Excel. This is a gre...
Run a Macro from Another Macro in Excel
Tutorial: I will show you how to run a macro from another macro in Excel.  This means that you can...
Run a Macro when a User Does Something in the Worksheet in Excel
Tutorial: How to run a macro when a user does something in the worksheet, everything from selecting ...
Pass Arguments to a Macro Called from a Button or Sheet in Excel
Tutorial: How to pass arguments and values to macros called from worksheets, buttons, and anything e...
Tutorial Details
Downloadable Files: Excel File
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course