Thank you very much, that is fantastic.
"vezerid" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Yes, you can use the Application.OnTime method. I am providing the full
> set of subs that you need. You will need a global variable to remember
> the next time a calculation is scheduled, so that you can stop periodic
> calculation:
>
> Public NextSchedule As Date
>
> Sub CalcRange()
> Sheets("Data").Range("E:F").Calculate
> End Sub
>
> Sub StartPeriodicCalculation()
> Call CalcRange
> NextSchedule = Now + TimeValue("00:01:00")
> Application.OnTime NextSchedule, "StartPeriodicCalculation"
> End Sub
>
> Sub StopPeriodicCalculation()
> Application.OnTime NextSchedule, "StartPeriodicCalculation", , False
> End Sub
>
> You call Start once. It will take care of subsequent schedules. Then
> you call Stop when you are done. In fact, it might be a better idea if
> you place the body of Stop in Workbook_BeforeClose, so that it is
> guaranteed to work even if you forget to call Stop explicitly.
>
> Beware, I have used OnTime in the past, even though I tried ways of
> ensuring that the scheduling stops, sometimes the cancellation did not
> work. The result was that Excel was restarting to execute the scheduled
> subs.
>
> HTH
> Kostis Vezerides
>
|