Written by Allen Wyatt (last updated March 30, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365
Russell is having a problem with Excel, when he runs macros. It seems that all of a sudden Ctrl+Break no longer stops the execution of a macro. Either the macro continues as if he had done nothing or Excel hangs up and he has to close it and start over. Russell checked and clicking the Stop Macro button (parallel line) in the VB menu doesn't work either, so this is not a problem of linkages to keys. He wonders if anyone else experienced this and if there is an easy fix.
This doesn't seem to be a common problem, as far as we can tell. It is possible that there is something errant going on in this particular system. For instance, it is possible that the EnableCancelKey property has been set to disabled, which would stop the normal functioning of Ctrl+Break. This property can be affected by the following macro line:
Application.EnableCancelKey = xlDisabled
This command could have been run in a macro which then did not enable the property. (Perhaps the macro coding either didn't include the enabling or the macro ended abnormally and never got to the command line to enable the property.) It is also possible that the command could have been entered in the immediate window of the VB Editor.
The setting of the property is persistent, and stays with a workbook if the workbook is saved after the setting is changed. You can check the setting by opening the VB Editor and entering the following in the immediate window:
? Application.EnableCancelKey
If you see a 0 displayed, this means that the property has been disabled. You should then enter the following in the immediate window:
Application.EnableCancelKey = xlInterrupt
After doing so, save the workbook. You should also try to track down where the property was initially disabled and make sure that the coding is corrected so you won't have the problem again.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3906) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
Excel allows you to format numeric values in many different ways, including as currency. If you want to determine, in a ...
Discover MoreWhen you use macros to create functions, you might want to share those functions with others�"particularly if they ...
Discover MoreWhen running a macro, have you ever seen Excel appear to stop responding? This can be frustrating, but there are a couple ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2022-03-30 05:43:55
Mike Hodkinson
Just to answer the long ago question on no break key on Lenovo.
You can use
Fn+Ctrl+P
https://www.petenetlive.com/KB/Article/0000930
2018-03-27 14:45:24
Bob E.
I have this issue weekly where if I have to work through 10,000 rows it'll start scrolling through the file but after a couple thousand lines it'll appear to freeze, even though later evidence proves that it was still crunching away and just not refreshing the screen, and hitting <CRTL><BREAK> or <ESC> while it's "frozen" will only gray out the screen. However, since I have most of my macros in a separate spreadsheet, if I click on that sheet in my toolbar, then <ESC> or <CTRL><BREAK> will interrupt the macro and allow me to end, continue or debug.
2018-03-24 19:04:12
Trevor R Bird
How do you issue a CTRL+Break when there is no Break key on the keyboard, as is the case with my Lenovo Thinkpad ?
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2023 Sharon Parq Associates, Inc.
Comments