Using this code:
In a module :
Option Explicit
Public RunWhen As Double
Public Const cRunIntervalSeconds = 1 ' 10 seconds
Public Const cRunWhat = "The_Sub" ' the name of the procedure to run
Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat, Schedule:=True
End Sub
Sub The_Sub()
[a1] = Now
' Call StartTimer to schedule the procedure again
StartTimer
End Sub
In ThisWorkBook:
Private Sub Workbook_Open()
The_Sub
End Sub
Bookmarks