Discussion:
How to stop VBA in a Loop
(too old to reply)
E***@discussions.microsoft.com
2007-06-29 01:35:51 UTC
Permalink
2003/2007


I realize that the info provided below is vague. Hitting the ESC key does not stop execution.

The loop is to cycle through a range of cells. As each new cell is accessed the loop causes
movement to/from other sheets to collect/parse data.

Therefore, there is much disk accessing and processor usage. Because of this, (I guess) the
keyboard is given low priority.

Bottom line, I would like to break execution to ascertain the area of the Loop.

The only success I have had is Ctrl-Alt-Delete to get Task Manager and then force Excel down.

Any thoughts appreciated,

EagleOne
David McRitchie
2007-06-29 01:53:10 UTC
Permalink
I don't really have much on debugging but what I have is at
http://www.mvps.org/dmcritchie/excel/getstarted.htm#problems

Here is Chip Pearson's page
VBA Debugging
http://www.cpearson.com/excel/Debug.htm
--
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
Post by E***@discussions.microsoft.com
2003/2007
I realize that the info provided below is vague. Hitting the ESC key does not stop execution.
The loop is to cycle through a range of cells. As each new cell is accessed the loop causes
movement to/from other sheets to collect/parse data.
Therefore, there is much disk accessing and processor usage. Because of this, (I guess) the
keyboard is given low priority.
Bottom line, I would like to break execution to ascertain the area of the Loop.
The only success I have had is Ctrl-Alt-Delete to get Task Manager and then force Excel down.
Any thoughts appreciated,
EagleOne
E***@discussions.microsoft.com
2007-06-29 03:21:14 UTC
Permalink
I'll look at your site in the morning. Thanks Dave.
Post by David McRitchie
I don't really have much on debugging but what I have is at
http://www.mvps.org/dmcritchie/excel/getstarted.htm#problems
Here is Chip Pearson's page
VBA Debugging
http://www.cpearson.com/excel/Debug.htm
blackbox via OfficeKB.com
2007-06-29 06:18:29 UTC
Permalink
Hit ESC twice to interrupt the code and get the End or Debug pop up
Post by E***@discussions.microsoft.com
I'll look at your site in the morning. Thanks Dave.
Post by David McRitchie
I don't really have much on debugging but what I have is at
http://www.mvps.org/dmcritchie/excel/getstarted.htm#problems
Here is Chip Pearson's page
VBA Debugging
http://www.cpearson.com/excel/Debug.htm
--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/excel-programming/200706/1
Shiva Kumar
2010-11-22 13:40:52 UTC
Permalink
Hello EagleOn,

Sorry to Inturrupt. As per your below message, if we follow we may loose changes made by us in the code.

So, it's better to use Ctrl+Pause Break. If we use this the changes made by us will be safe and stop's the loop.

Shiva.
Post by E***@discussions.microsoft.com
2003/2007
I realize that the info provided below is vague. Hitting the ESC key does not stop execution.
The loop is to cycle through a range of cells. As each new cell is accessed the loop causes
movement to/from other sheets to collect/parse data.
Therefore, there is much disk accessing and processor usage. Because of this, (I guess) the
keyboard is given low priority.
Bottom line, I would like to break execution to ascertain the area of the Loop.
The only success I have had is Ctrl-Alt-Delete to get Task Manager and then force Excel down.
Any thoughts appreciated,
EagleOne
Post by David McRitchie
I don't really have much on debugging but what I have is at
http://www.mvps.org/dmcritchie/excel/getstarted.htm#problems
Here is Chip Pearson's page
VBA Debugging
http://www.cpearson.com/excel/Debug.htm
--
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
Submitted via EggHeadCafe
Custom task processes in SharePoint Designer Workflows
http://www.eggheadcafe.com/tutorials/aspnet/872c3a54-cc00-4fa0-b98b-2e9ea9a559dd/custom-task-processes-in-sharepoint-designer-workflows.aspx
Mikec007
2010-11-22 14:28:25 UTC
Permalink
Why not code your loop to stop when it reaches the end??

If you are going through a range of cells, find the last row in the
range, and tell the loop next until finalrow.
Post by Shiva Kumar
Hello EagleOn,
Sorry to Inturrupt. As per your below message, if we follow we may
loose changes made by us in the code.
So, it's better to use Ctrl+Pause Break. If we use this the changes
made by us will be safe and stop's the loop.
Shiva.
Post by E***@discussions.microsoft.com
2003/2007
I realize that the info provided below is vague. Hitting the ESC key
does not stop execution.
The loop is to cycle through a range of cells. As each new cell is
accessed the loop causes
movement to/from other sheets to collect/parse data.
Therefore, there is much disk accessing and processor usage. Because
of this, (I guess) the
keyboard is given low priority.
Bottom line, I would like to break execution to ascertain the area of the Loop.
The only success I have had is Ctrl-Alt-Delete to get Task Manager and
then force Excel down.
Any thoughts appreciated,
EagleOne
Post by David McRitchie
I don't really have much on debugging but what I have is at
http://www.mvps.org/dmcritchie/excel/getstarted.htm#problems
Here is Chip Pearson's page
VBA Debugging
http://www.cpearson.com/excel/Debug.htm
--
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
Submitted via EggHeadCafe
Custom task processes in SharePoint Designer Workflows
http://www.eggheadcafe.com/tutorials/aspnet/872c3a54-cc00-4fa0-b98b-2e9ea9a559dd/custom-task-processes-in-sharepoint-designer-workflows.aspx
Walter Briscoe
2010-11-22 19:34:57 UTC
Permalink
In message <4cea7e36$0$10388$***@usenet-news.net> of Mon, 22 Nov
2010 09:28:25 in microsoft.public.excel.programming, Mikec007
Post by Mikec007
Why not code your loop to stop when it reaches the end??
If you are going through a range of cells, find the last row in the
range, and tell the loop next until finalrow.
Post by Shiva Kumar
Hello EagleOn,
Sorry to Inturrupt. As per your below message, if we follow we may
loose changes made by us in the code.
So, it's better to use Ctrl+Pause Break. If we use this the changes
made by us will be safe and stop's the loop.
Shiva.
Post by E***@discussions.microsoft.com
2003/2007
I realize that the info provided below is vague. Hitting the ESC
key does not stop execution.
I assume you want to interrupt execution, rather than merely stop -
usually because you have started something you have decided is
unprofitable.

The DoEvents Function yields execution so that the operating system can
process other events.

I am suspicious that it does not always work.
I wait for Internet Explorer to complete with
Do Until Not IE.busy And IE.ReadyState = 4: DoEvents: Loop
Post by Mikec007
Post by Shiva Kumar
Post by E***@discussions.microsoft.com
The loop is to cycle through a range of cells. As each new cell is
accessed the loop causes
movement to/from other sheets to collect/parse data.
Therefore, there is much disk accessing and processor usage.
Because of this, (I guess) the
keyboard is given low priority.
Bottom line, I would like to break execution to ascertain the area of the Loop.
The only success I have had is Ctrl-Alt-Delete to get Task Manager
and then force Excel down.
Any thoughts appreciated,
I would put DoEvents into your loop at a point where the data is
consistent.

Powering down can also be effective at the cost of risking inconsistent
data.

You may later want to look at Application.OnTime; I don't think it will
help.
Post by Mikec007
Post by Shiva Kumar
Post by E***@discussions.microsoft.com
EagleOne
Post by David McRitchie
I don't really have much on debugging but what I have is at
http://www.mvps.org/dmcritchie/excel/getstarted.htm#problems
Here is Chip Pearson's page
VBA Debugging
http://www.cpearson.com/excel/Debug.htm
-- HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
Submitted via EggHeadCafe Custom task processes in SharePoint
Designer Workflows
http://www.eggheadcafe.com/tutorials/aspnet/872c3a54-cc00-4fa0-b98b
-2e9ea9a559dd/custom-task-processes-in-sharepoint-designer-
workflows.aspx
--
Walter Briscoe
Continue reading on narkive:
Loading...