Need a excel formula which can see the second moving
Yes I see....
Try this again
Dim SchedRecalc As Date
Sub Recalc()
Dim wbk As Workbook
Dim ws As Worksheet
Set wbk = ThisWorkbook
Set ws = wbk.Sheets("Sheet1")
ws.Range("A1").Value = Format(Now, "dd-mmm-yy")
ws.Range("B1").Value = Format(Time, "hh:mm:ss AM/PM")
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, Procedu="Recalc",
Schedule:=False
End Sub
Use the disable macro to stop the clock
Also in the workbook close event you can disable the macro
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Disable
End Sub
Start the clock when you open the workbook
Private Sub Workbook_Open()
Recalc
End Sub
the last two codes go in the workbook module
|