ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   count down (https://www.excelbanter.com/excel-discussion-misc-queries/20752-count-down.html)

jason l

count down
 
i wish to set up a countdown timer showing date + hours, minutes and seconds
i have used the formula =now() for todays correct date and time and a fixed
date to countdown to but i cannot get a formula to work to count it down....

Tom Hewitt

Jason,

I know what you need to do just not 100% how to do it. Your problem is that
the now formula will only calculate when you click into it. Your need a
timing rountine with VBA to calc that cell every so many minutes seconds.
I'm at a loss of how to do a VBA timing rountine thou. Sure someone else
will know.

Cheers
Tom

"jason l" wrote:

i wish to set up a countdown timer showing date + hours, minutes and seconds
i have used the formula =now() for todays correct date and time and a fixed
date to countdown to but i cannot get a formula to work to count it down....


P Sitaram

See if you can adapt some of this code:

http://www.cpearson.com/excel/ontime.htm


Tom Hewitt

,

Heres what you need to do.

3 Macros As follows

1.

Sub Start()
'
' The_Sub Macro
' Macro recorded 06/04/2005 by Tom Hewitt
'


'
Calculate
'
RepeatTimer

End Sub

==========
The first Macro starts the calucation process.


Macro 2.

Sub RepeatTimer()
'
' Starttimer Macro
' Macro recorded 06/04/2005 by Tom Hewitt
'

RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime earliesttime:=RunWhen, procedu="Start", _
schedule:=True
End Sub

=========
This repeats the process. On the first line alter the number 1 to the
number of seconds you require the calculation interval to be.

Macro 3.

Sub StopTimer()
'
' StopTimer Macro
' Macro recorded 06/04/2005 by Tom Hewitt


'
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub

========
This stops the timer.

Enjoy. Adapted from the linked site mentioned in the thread above.

Cheers
Tom Hewitt



"P Sitaram" wrote:

See if you can adapt some of this code:

http://www.cpearson.com/excel/ontime.htm




All times are GMT +1. The time now is 03:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com