View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default countdown timer in a cell

Public NextTime As Date
Public EndTime As Date


Sub StartCount()
EndTime = Now + TimeValue("00:00:15")
NextTime = Now + TimeValue("00:00:01")
ActiveSheet.Range("A1").NumberFormat = "hh:mm:ss"
ActiveSheet.Range("A1").Value = EndTime - Now
Application.OnTime NextTime, "Continuecount"
End Sub

Sub Continuecount()
NextTime = Now + TimeValue("00:00:01")
If EndTime - Now < 0 Then Exit Sub
ActiveSheet.Range("A1").Value = EndTime - Now
Application.OnTime NextTime, "Continuecount"
End Sub


--
Regards,
Tom Ogilvy

"David W" wrote in message
...
is it possible to have a countdown timer in a cell,
can it be triggered when then sheet is opened and countdown from 15secs.

or is there a way to display the time from 'ontime' that you would use to
pause an application

right now I have got a sheet that shows for 15secs., then a different

sheet
shows after that. Is there way to take that countdown time and show it or
does it count up

what the end result will be is a sheet that shows for 15 sec then goes

away
,during the showing of that sheet I would like for a timer to countdown to

0
in a cell so that the user will know how many seconds is left for viewing