PDA

View Full Version : Countdown between dates



georgiboy
01-04-2009, 07:31 AM
Hi all and thanks for looking

Here is my question...

Lets say i have =Now() in range("A1") and a future date in range("A2").
What i am after is the code to place a countdown timer in range("A3").

The countdown timer will need to count Year/Month/Day/Hour/Minute/Second until it reaches the future date, at which point i would like it to display a message box.

I would like it to count seconds in reverse, 59-58-57-56 for example.

If you need any more info let me know

:beerchug:

George

xld
01-04-2009, 08:30 AM
Public nTime As Double
Public nRemain As Double

Public Sub TimeIt()
With Worksheets("Sheet3")

nRemain = .Range("A2").Value - .Range("A1").Value
If nRemain > 0 Then

.Range("A3").Value = nRemain
.Range("A3").NumberFormat = "d ""days"" h:mm:ss"
nTime = Now + TimeSerial(0, 0, 1)
Application.OnTime nTime, "TimeIt"
End If
End With

End Sub

jolivanes
01-04-2009, 08:36 AM
Attached a possible start.
Needs some cleaning and changes but see what you think.

HTH

John