Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default How to stop VBA in a Loop

In message of Mon, 22 Nov
2010 09:28:25 in microsoft.public.excel.programming, Mikec007
writes
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.


On 2010-11-22 08:40:52 -0500, Shiva Kumar said:

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.

On Thursday, June 28, 2007 9:35 PM EagleOn wrote:


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

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.

EagleOne


On Thursday, June 28, 2007 9:53 PM David McRitchie wrote:


I don't really have much on debugging but what I have is at
http://www.mvps.org/dmcritchie/excel...d.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
wrote in message news:5sn883
...


Submitted via EggHeadCafe Custom task processes in SharePoint
Designer Workflows
http://www.eggheadcafe.com/tutorials...cc00-4fa0-b98b
-2e9ea9a559dd/custom-task-processes-in-sharepoint-designer-
workflows.aspx






--
Walter Briscoe
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop Loop pjd33 Excel Programming 4 May 24th 07 05:21 PM
Do Loop doesn't stop [email protected][_2_] Excel Programming 5 May 22nd 07 07:32 PM
Stop Loop Robert[_30_] Excel Programming 2 January 17th 07 01:34 PM
Hot key to stop a LOOP joopdog[_3_] Excel Programming 5 February 9th 06 06:51 PM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM


All times are GMT +1. The time now is 01:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"