PDA

View Full Version : Countdown timer to a specific date



omar23j
04-27-2018, 07:24 AM
Hi everyone,

I need some help doing a countdown timer ( DD:HH:MM:SS) for a power-point presentation. It needs to countdown from the current time until a specific date ( November 7th, 2018) . I am assuming this can be done with VBA. Can someone please help me?

SamT
04-27-2018, 07:35 AM
Count down number of Days from now to 07/11/2018?

Count down number of Seconds from now to 07/11/2018 00:00:01?

omar23j
04-27-2018, 07:55 AM
Count down number of Days from now to 07/11/2018?

Count down number of Seconds from now to 07/11/2018 00:00:01?

Thank you for your reply! I would like a Countdown of days, hours, minutes and seconds in the format (DDD:HH:MM:SS). The countdown is from now until 07/11/2018 00:00:01.

Logit
04-27-2018, 11:15 AM
.
Here is one way :



Option Explicit


Sub Countdown()
Dim thedate As Date
Dim daycount As Long


'change to suit
thedate = "07/11/2018 00:00:01"


daycount = DateDiff("d", Now, thedate)


Select Case daycount
Case Is > 1
Sheets("Sheet1").Range("A1").Value = daycount & " Days to go!"
Case Is = 1
Sheets("Sheet1").Range("A1").Value = daycount & " Day to go!"
Case Else
Sheets("Sheet1").Range("A1").Value = "It's here!"
End Select

End Sub

omar23j
04-27-2018, 01:39 PM
.
Here is one way :



Option Explicit


Sub Countdown()
Dim thedate As Date
Dim daycount As Long


'change to suit
thedate = "07/11/2018 00:00:01"


daycount = DateDiff("d", Now, thedate)


Select Case daycount
Case Is > 1
Sheets("Sheet1").Range("A1").Value = daycount & " Days to go!"
Case Is = 1
Sheets("Sheet1").Range("A1").Value = daycount & " Day to go!"
Case Else
Sheets("Sheet1").Range("A1").Value = "It's here!"
End Select

End Sub


Thank you but I was looking to implement this in powerpoint! Also I only see the day count ;/

SamT
04-27-2018, 01:43 PM
Place this code in a Standard Module
Public Function CountDown()
Dim Later As Date

Application.Volatile
Later = CDate("07/11/2018 00:00:01")
CountDown = Format(Later - Now, "d:h:mm:ss")
End Function
To use it, in any Cell use the formula

=Countown

To be able to change the count down to date, place this Function in a standard Module
Option Explicit

Public Function CountDown(ToTime As Variant)
Dim Later As Date

Application.Volatile
Later = CDate(ToTime)
CountDown = FormatLater - Now, "d:h:mm:ss")
End Function



You can use two cell formulas with it

=CountDown("07/11/2018 00:00:01")
Or

=CountDown(A1) 'Where the new date/time is in Cell A1

omar23j
05-15-2018, 07:45 AM
Place this code in a Standard Module
Public Function CountDown()
Dim Later As Date

Application.Volatile
Later = CDate("07/11/2018 00:00:01")
CountDown = Format(Later - Now, "d:h:mm:ss")
End Function
To use it, in any Cell use the formula

=Countown

To be able to change the count down to date, place this Function in a standard Module
Option Explicit

Public Function CountDown(ToTime As Variant)
Dim Later As Date

Application.Volatile
Later = CDate(ToTime)
CountDown = FormatLater - Now, "d:h:mm:ss")
End Function



You can use two cell formulas with it

=CountDown("07/11/2018 00:00:01")
Or

=CountDown(A1) 'Where the new date/time is in Cell A1


Hi, I know this has been a while but I could not get this to work. Applicaton.volatile does not seem to be recognized in power point VBA? Also do I have to run this in a cell inside the powerpoint slide?

Thank you

SamT
05-15-2018, 10:55 AM
I'm sorry. I don't 'speak' PowerPoint. I am afraid that it's up to you to refactor that Excel Code to PowerPoint.

Or wait a bit and see if a PP Guru shows up to help you.