Timer in Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to set a timer at 1 minute interval for various time ranges. Start
time is in cell C2, end time is in cell D2. This time frame is mostly less
than 2 hours, but on rare occassions can be upto 4 hours.
 
Hi I am little confused...when you say set a timer at a1 minute
interval ..do you mean display the time elaspsed every minute...for the
period between C2 and D2??if so where do you want to see the elapsed
time?
 
Try something like

Sub CallTimer()

If nTime = 0 Then
nTime = Range("B2").Value
Else
Range("A1").Value = Format(Now(), "hh:mm")
End If
If nTime < Range("D2").Value Then
nTime = nTime + TimeSerial(0, 1, 0)
Application.OnTime Date + nTime, "CallTimer"
End If
End Sub



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Steve,
Sorry: Starting in column B, at cell B4 thru B?? at 1 minute interval until
time is equal to cell D2.
Thanx :-)
FloMM2
 
Bob,
I ran your sample, after adding a DIM nTime.
It runs, but the data (time) is not added to the spreadsheet.
Thanx:-)
FloMM2
 
Sub CallTimer()

If nTime = 0 Then
nTime = Range("B2").Value
Else
Range("A1").End(xlup)(2).Value = Format(Now(), "hh:mm")
End If
If nTime < Range("D2").Value Then
nTime = now() + TimeSerial(0, 1, 0)
Application.OnTime ntime, "CallTimer"
End If
End Sub

If you are actively using the computer while this is running, it could cause
variations in the times posted.
 

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

Similar Threads


Back
Top