View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
AVR AVR is offline
external usenet poster
 
Posts: 14
Default Pausing code execution until calculation is complete

Seems to me that the calculate event happens 1st. The problem is that
changes in the cells impact several hundred calculations which are iterative
and take time. The recalc takes about 90 seconds. If I had a way to know
that the calc was complete, I could wait for it before doing the sheet
manipulations. If I issue a calculate command from code, is there a way to
make sure it completes before moving on in the code?


"Tom Ogilvy" wrote:

you don't have any control on when the event fires. You do have control on
what the event does. You might look at application.Ontime to have the event
trigger off the actions you want to take with a delay.

http://www.cpearson.com/excel/ontime.htm

for information on using ontime.

that said, in my testing, calculate completes before the change event fires.
I believe that isn't true for a DDE connection - and I have worked around
that by having the event issue a calculate command. So you may have
something special going on. If so, it might be helpful to say what isn't
getting completed before your change event.

--
Regards,
Tom Ogilvy


"AVR" wrote:

I have posted several questions on worksheet change event behavior, but I
have narrowed the problem down to the recalculation that coincides with the
change event. Is there a way to delay the execution of code inside a
Worksheet_Change subroutine until after any recalculation caused by the
change is complete?