why do I need Application.EnableCancelKey = xlDisabled

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
2,134
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
I've been working on something for several days when suddenly I get error Code execution has been interrupted
Click debug and you can step through the code without any errors.
After mucking around for ages including a widows reboot I Googled and found
The solution for this problem is to add the line of code “Application.EnableCancelKey = xlDisabled” in the first line of your macro. This will fix the problem.
And they're right - it does. Take it out and the problem reoccurs.
But why? I never needed it until now. Anyone know what has changed/happened?
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
It probably depends on the rest of your code. If you are willing, post all of your code for review.
Or it might be the result of a recent Windows update?
 
Upvote 0
Thanks @Logit, i would have posted my code, but it was depended on local files.
I'm pretty sure I have resolved it, but without knowing exactly why. I must have have something invisible on the sheet and after selected and deleting a whole
range of empty rows, I no longer need that xlDisabled instruction.
 
Upvote 0

Forum statistics

Threads
1,226,063
Messages
6,188,653
Members
453,489
Latest member
jessrw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top