Thread: End loop
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default End loop

If your Do...Loop loop is running continuously, then obviously it is not
finding a condition that meets the While or Until criteria. You need to
review your code and revise it so that the logic will produce a result that
is either true or false based on what you tell the loop to evaluate.
Otherwise, you are wasting code.

"Sandy" wrote:

I have a sub that runs continuously and I would like a better
way of stopping it other than pressing 'Esc' or 'Ctrl+Break'.
When I do press 'Esc' or 'Ctrl+Break' I end up with an error
message for debugging.

What I thought might be a possibility but I haven't got a clue
how to do it is to have a button that when clicked will -
"end the loop after this particular run" - can this be achieved?


Sub ContinuousLoop()
Do
*****Lots of Code*******
Loop
End Sub

Any ideas would be good.
Sandy