Continuous calculation of a formula.
Public whn As Double
Public Const T = 2 ' two seconds
Public Const macroo = "refresh" ' the name of the procedure to run
Sub refresh()
Application.CalculateFull
StartTimer
End Sub
Sub StartTimer()
whn = Now + TimeSerial(0, 0, T)
Application.OnTime EarliestTime:=whn, Procedu=macroo, Schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime EarliestTime:=whn, Procedu=macroo, Schedule:=False
End Sub
Run StartTimer to begin and StopTImer to end. The worksheet will be
re-calculated every two seconds.
--
Gary''s Student - gsnu200833
"Husker87" wrote:
I created a €śCountdown€ť clock to an event in our company. Just the actual
date minus todays date. Anyway, it just calculates days, hours, mins, secs
until an event. The problem is that you either have to hit F9 or some other
cell to get it to re-calculate the formulas. I set up a macro and tied it to
a €śrefresh€ť button but does anyone know how I could get the spreadsheet to
calculate every second automatically or perhaps another way to add a
€śCountdown clock€ť to my spreadsheet?
Thanks!
|