Option Explicit
Public dTime As Date
Private Sub Workbook_Open()
Call ValueStore
End Sub
Sub ValueStore()
Dim dTime As Date
Range("Now").Formula = "=VLOOKUP(TIME(HOUR(NOW()),MINUTE(NOW()),SECOND(NOW())),Sheet2!$A$4:$Q$1444,16)+VLOOKUP(TIME(HOUR(NOW()),MINUTE(NOW()),SECOND(NOW())),Sheet2!$A$4:"
Range("Now_Plus_15").Formula = "=VLOOKUP(TIME(HOUR(NOW()),MINUTE(NOW())+15,SECOND(NOW())),Sheet2!$A$4:$Q$1444,16)+VLOOKUP(TIME(HOUR(NOW()),MINUTE(NOW())+15,SECOND(NOW())),Sheet2!$A$4:"
Call StartTimer
End Sub
Sub StartTimer()
dTime = Now + TimeValue("00:01:00")
Application.OnTime dTime, "ValueStore", Schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime dTime, "ValueStore", Schedule:=False
End Sub
|