Greetings,
Dim Timer As Boolean 'put this at the beginning of the Module
Sub RunEveryFiveSecs()
Dim seconds As Long
seconds = CDate(Format(Time, "ss"))
MsgBox seconds 'Can remove the Msgbox because it will be annoying as well as what's in RED
If Timer = True then
ThisWorkbook.RefreshAll
Application.OnTime Now + TimeValue("00:00:05"), "RunEveryFiveSecs"
End if
End Sub
Sub StopIt()
'If you want it to stop after you close the workbook, then put this in the event workbook close
'Call StopIt
'Can also be used in a button to stop the loop
Timer = False
End Sub
Sub StartIt
'Use this for some button or something like that to start the loop
Timer = True
Call RunEveryFiveSecs
End Sub
Maybe this will help.
Regards,
Daniel
Bookmarks