View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Interrupting a Loop

Rather than incrementing a counter I find it is usually better to use a timed
loop for things like this:

Dim StopTime as Date
StopTime = Now() + TimeValue("00:02:00") ' two second timed loop
While Now() < StopTime ...
....
WEnd

The timing is not precise, but you have better control than when you just
increment a counter: when you use a counter or fixed number of iterations the
time taken to complete the loop can vary a lot depending on everything else
happening on your PC.
--
- K Dales


"Maxi" wrote:

hey sorry !!


Its working......... I reduced the counter of (While ctr < 600000 And
Not (StopIt)) from 600000 to 2500

Thanks a lot