This is adapted from Pearson's page:
http://www.cpearson.com/excel/OnTime.aspx
Here is the code:
Public RunWhen As Double
Public Const cRunIntervalSeconds = 2 ' two seconds
Public Const cRunWhat = "refresh" ' the name of the procedure to run
Sub refresh()
Application.CalculateFull
StartTimer
End Sub
Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat,
Schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat,
Schedule:=False
End Sub
To install from Excel and use:
1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window
If you save the workbook, the macro will be saved with it.
To use the macro from the normal Excel window:
1. ALT-F8
2. Select StartTimer
3. Touch Run
The clocks will begin to update
To remove the macro:
1. run StopTimer as above
2. bring up the VBE window as above
3. clear the code out
4. close the VBE window
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm