TheRobRush
New Member
- Joined
- Nov 5, 2018
- Messages
- 39
I have the following code in my modules. It works great, for what it was intended to do. (Keep a running clock for scheduling purposes, break meal penalties etc)
The issue arises if you have two copies of the file open at the same time.
When two files with this code in it ARE open, when you close one it will immediately REOPEN itself.
Any ideas?
The issue arises if you have two copies of the file open at the same time.
When two files with this code in it ARE open, when you close one it will immediately REOPEN itself.
Any ideas?
Code:
Dim SchedRecalc As Date
Sub Recalc()
With Range("CG1")
.Value = Format(Time, "hh:mm:ss AM/PM")
End With
Call SetTime
End Sub
Sub SetTime()
SchedRecalc = Now + TimeValue("00:00:01")
Application.OnTime SchedRecalc, "Recalc"
End Sub
Sub Disable()
On Error Resume Next
Application.OnTime EarliestTime:=SchedRecalc, Procedure:="Recalc", Schedule:=False
End Sub