View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harlan Grove[_5_] Harlan Grove[_5_] is offline
external usenet poster
 
Posts: 97
Default For Next loop problem

"Jo" wrote...
Is there a limited time a for next loop will run? (not
counted). The end of the data is marked by text "END".
This works fine for small amounts of data, but seems to
exit around 96 samples. If I then re-run it its fine and
exits correctly.

...
various stuff here (cells get deleted and moved up)
Next

...

If you're deleting cells, better to iterate from bottom to top or right to left.
So don't use a For Each loop, use

Dim n As Long
':
For n = Range("Results").Rows.Count To 1 Step -1
':

--
To top-post is human, to bottom-post and snip is sublime.