Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to set up countdown timer to countdown days to a specific day | Excel Worksheet Functions | |||
Countdown Timer | Excel Discussion (Misc queries) | |||
Countdown Timer | Excel Discussion (Misc queries) | |||
HELP for COUNTDOWN TIMER | Excel Discussion (Misc queries) | |||
Is a countdown timer possible? | Excel Discussion (Misc queries) |