I find working with Macros quite fun. I have automated many of my repetitive, manual and really really boring tasks with Excel VBA Macros. Once I got a task of copy-pasting more than 10,000 lines of items one-by-one from Excel to one of our ERP system and print these items. Usually, it would have taken me several days to finish this task but with macros, I finished it in no time. I will share more about it in a future post and share my secret Macro Codes but first let’s get back to the current problem at hand. Many times, if you execute a Macro command in a loop such as copy-pasting 10,000 lines of items one at a time and then you realise that something is wrong but you cannot wait until the Macro finishes the task. In such situation, you may like to stop or interrupt the running Macro. One hard way of doing it is closing your Excel file but you can do it without closing your Excel file so that you won’t lose the data in your file.
Two easy ways to stop or Interrupt a running Macro Command are –
- Keep hitting the Escape button several times until your macro stops. Then click End option in the message box.
- Hit Ctrl+Break Button together. It will interrupt, then click End option in the message box.
It may happen that, both Escape or Ctrl+Break button may not work for you. As your Macro may have “Application.EnableCancelKey = xlDisabled” command line which may not allow you to interrupt the ongoing Macro command. In such a case, you can simply remove this line of an item and add a new command line – “Application.EnableCancelKey = xlInterrupt” It will allow you to interrupt the ongoing Macro comman