Has anybody else noticed that Microsoft has finally fixed VBA so that control break always works?
And If I am wrong about it being fixed can anybody post a snippet of an "unbreakable" loop ?
For instance on my Windows 10 Office Pro 2010 system the following loop can now be interrupted with ctrl break. In the past, ctrl break, ctrl esc etc did not stop the loop.
Do while true
Rberke (aka UncleBob)
When I am writing complicated vba code I try to save my program about every half hour. This has avoided tons of grief when I accidentally code an "unbreakable" loop,
For most of the past 20 years, to stop such a loop I would use task manger to kill Excel. Upon restart Excel would revert to the most recent save and I would need to spend a few minutes retyping the lost code.
This happened so often that I eventually wrote an Unfreeze subroutine which I called at the top of almost every loop. (After my code was totally debugged I could remove the Unfreeze calls, but I often left them in place.)
For each cell in myRange.cells
if cell like desiredpattern then exit for
I = I + 1
If (I mod 100) = 0 then doevents
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.