Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default countdown timer in a cell

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default countdown timer in a cell

Where do you put this?

"Tom Ogilvy" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default countdown timer in a cell

In a general module.

You will have to call startcount from the code that shows the sheet.

This executes asynchronously, you can't call it and wait for it to finish.
You would put in code to hide the sheet and continue processing in the
Continuecount routine - see revised example below.

Sub Continuecount()
Dim sh as Worksheet
NextTime = Now + TimeValue("00:00:01")
If EndTime - Now < 0 Then
set sh = ActiveSheet
worksheets("something").Activate
sh.Visible = xlSheetHidden
' call code to continue process
Else
ActiveSheet.Range("A1").Value = EndTime - Now
Application.OnTime NextTime, "Continuecount"
End if
End Sub

--
Regards,
Tom Ogilvy


"David W" wrote in message
...
Where do you put this?

"Tom Ogilvy" wrote in message
...
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





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default countdown timer in a cell

how do you pull the start count?
"Tom Ogilvy" wrote in message
...
In a general module.

You will have to call startcount from the code that shows the sheet.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set up countdown timer to countdown days to a specific day Jenny Excel Worksheet Functions 3 May 8th 23 07:43 PM
Countdown Timer Robert_NSBG Excel Discussion (Misc queries) 1 December 11th 08 08:54 PM
Countdown Timer Saxman Excel Discussion (Misc queries) 1 February 6th 07 09:55 AM
HELP for COUNTDOWN TIMER CC Excel Discussion (Misc queries) 3 May 8th 06 12:44 PM
Is a countdown timer possible? aharmer Excel Discussion (Misc queries) 1 February 8th 05 01:47 AM


All times are GMT +1. The time now is 10:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"