checking elapsed seconds

  • Thread starter Thread starter Bert
  • Start date Start date
B

Bert

I'd like to assign the current time + 10 seconds to variable, TriggerTime.
Then I'll compare TriggerTime with the current time later in a code loop,
and if the current time is greater, then branch to other code. Seems as
though this should be simple, but I'm not getting it.
Thanks.
Bert
 
Sub time_it()
MsgBox (Time + 10)
End Sub

later compare to Time
 
Try this:-

Sub TimeTest()

Dim dbl10Sec As Double
Dim TriggerTime As Double

dbl10Sec = TimeSerial(0, 0, 10)
TriggerTime = Time + dbl10Sec

If TimeTrigger > Time Then
MsgBox Time & " - " & Format(TriggerTime, "hh:mm:ss")
End If

End Sub

James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top