Hi All, I have a macro that I have set to run run every 30 mins, however it shouldn't be run between 18:30pm and 07:00am. My code is below and it stops at 18:30pm no problem but then never starts again in the morning. Hopefully something simple I've missed..
Sub RunTimer()
'ONLY RUN THE MACRO BETWEEN 18:30 AND 0730AM
If Format(Now(), "HHMM") > "0729" And Format(Now(), "HHMM") < "1845" Then
Report
Application.Wait (Now + TimeValue("0:00:15"))
PrepWork
' submit macro to run again in X mins
Application.OnTime Now + TimeValue("00:30:00"), "RunTimer"
End If
End Sub
Thanks, John
Bookmarks