Parkerpen13
New Member
- Joined
- Feb 26, 2018
- Messages
- 41
I have a clock that works off from auto refresh and works great but I have to start it off from a button. How would I change my code to automatically run when I open the workbook so I can eliminate the button?
[FONT="]Dim SchedRecalc As Date[/FONT]
[FONT="]Sub Recalc()[/FONT]
[FONT="]With Sheet1.Range("A1")[/FONT]
[FONT="].Value = Format(Time, "hh:mm:ss AM/PM")[/FONT]
[FONT="]End With[/FONT]
[FONT="]Call SetTime[/FONT]
[FONT="]End Sub [/FONT]
[FONT="]Sub SetTime()[/FONT]
[FONT="]SchedRecalc = Now + TimeValue("00:00:01")[/FONT]
[FONT="]Application.OnTime SchedRecalc, "Recalc"[/FONT]
[FONT="]End Sub [/FONT]
[FONT="]Sub Disable()[/FONT]
[FONT="]On Error Resume Next[/FONT]
[FONT="]Application.OnTime EarliestTime:=SchedRecalc, Procedure:="Recalc", Schedule:=False[/FONT]
[FONT="]End Sub[/FONT]
[FONT="]Dim SchedRecalc As Date[/FONT]
[FONT="]Sub Recalc()[/FONT]
[FONT="]With Sheet1.Range("A1")[/FONT]
[FONT="].Value = Format(Time, "hh:mm:ss AM/PM")[/FONT]
[FONT="]End With[/FONT]
[FONT="]Call SetTime[/FONT]
[FONT="]End Sub [/FONT]
[FONT="]Sub SetTime()[/FONT]
[FONT="]SchedRecalc = Now + TimeValue("00:00:01")[/FONT]
[FONT="]Application.OnTime SchedRecalc, "Recalc"[/FONT]
[FONT="]End Sub [/FONT]
[FONT="]Sub Disable()[/FONT]
[FONT="]On Error Resume Next[/FONT]
[FONT="]Application.OnTime EarliestTime:=SchedRecalc, Procedure:="Recalc", Schedule:=False[/FONT]
[FONT="]End Sub[/FONT]