I was trying to make the current date in the file (Sheet 1, cell I3) update every 10 seconds, but after trying multiple things, it just won't work.
My plan was to make the time in the cell update every 10 seconds, instead of having to edit the file to update the time. I am not familiar with VBA, could anyone explain what I'm doing wrong?
Code:
Sub Calculate_Range()
Worksheets("Display").Range(I3).Calculate
Application.OnTime DateAdd("s", 10, Now), "Calculate_Range"
End Sub
CodePudding user response:
You can play around with this.
Dim TimeRQ As Date
Sub RQ()
With Sheet1.Range("I3")
.Value = Format(Time, "hh:mm:ss AM/PM")
End With
Call DeffTime
End Sub
Sub DeffTime()
TimeRQ = Now TimeValue("00:00:01")
Application.OnTime TimeRQ, "RQ"
End Sub
Sub Disable()
On Error Resume Next
Application.OnTime EarliestTime:=TimeRQ, Procedure:="RQ", Schedule:=False
End Sub