Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control Break out of Infinite Loop In 2010 (2013) Excel VBA

If I write code creating an infinite loop, with my new Excel, the Ctrl + Break no longer works. Neither does the Esc key, etc.

I've looked all over the web and it appears that Microsoft has a bug and doesn't care to fix it.

Is there a way to re-introduce the Ctrl + Break function to VBA so if this happens in the future I don't lose work / force close?

like image 609
Tommy Z Avatar asked Feb 12 '14 19:02

Tommy Z


People also ask

How do I stop an infinite loop in Excel VBA?

Option 1: Hold the Esc key down for more than a few seconds. Option 2: Press CTRL+BREAK. Option 3: CTRL + ALT + DEL to end process & have Auto recover when you re-open.

How do you break a loop in Excel VBA?

AutoCAD to Excel - VBA Programming Hands-On!A Exit For statement is used when we want to exit the For Loop based on certain criteria. When Exit For is executed, the control jumps to the next statement immediately after the For Loop.

How do you stop a loop from running in VBA?

Try: Press and hold down the "CTRL" key, and press the "Break" (Pause) key.


2 Answers

Alt + Esc. Hold down the keys until it breaks.

From Windows 7 on, this will cycle through all open windows. Pay no mind, just keep squeezing it.

like image 125
John Avatar answered Oct 03 '22 20:10

John


On Office 2013, at least, Ctrl+Scroll Lock does it. I didn't need to change any settings or enable anything.

(Blatant plug: my blog post linking to the original source of this info :) )

like image 30
cxw Avatar answered Oct 03 '22 21:10

cxw