View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default VBA | Individual Iterations faster than Loop Statement

Are you creating variables which are not being released at the end? It may
be best to show the code in more detail.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Butaambala" wrote in message
oups.com...
I have a procedure that loops through 14 data sets, evaluating the
variables for inclusion in a model.

I find that when I LOOP through the 14 iterations, the performance
seems "bogged-down", and often results in 'not enough memory' errors
and the like. Code sample:

i = 1
Do while i <= 14
...CODE....
...CODE....
...CODE....
i = i +1
Loop

Executing each iteration manually, however, results in more efficient
processing, no errors, and accurate results. The problem, of course,
is that I'd like to LOOP so I can start the procedure, go to sleep, and
awake with accurate results. Instead I am a slave to the computer to
affect one key-stroke every 30 mins.

This evidence begs the question: How does the computer differentiate
the two approaches? How can I programmatically replicate the
difference?

Any thoughts?