Consulting

Results 1 to 8 of 8

Thread: Countdown timer to a specific date

  1. #1
    VBAX Newbie
    Joined
    Apr 2018
    Posts
    4
    Location

    Countdown timer to a specific date

    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?
    Last edited by omar23j; 04-27-2018 at 07:25 AM. Reason: wrong word

  2. #2
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    6,782
    Location
    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?
    Please take the time to read the Forum FAQ

  3. #3
    VBAX Newbie
    Joined
    Apr 2018
    Posts
    4
    Location
    Quote Originally Posted by SamT View Post
    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.

  4. #4
    VBAX Tutor Logit's Avatar
    Joined
    Sep 2016
    Posts
    249
    Location
    .
    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
    Attached Files Attached Files

  5. #5
    VBAX Newbie
    Joined
    Apr 2018
    Posts
    4
    Location
    Quote Originally Posted by Logit View Post
    .
    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 ;/

  6. #6
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    6,782
    Location
    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
    Please take the time to read the Forum FAQ

  7. #7
    VBAX Newbie
    Joined
    Apr 2018
    Posts
    4
    Location
    Quote Originally Posted by SamT View Post
    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

  8. #8
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    6,782
    Location
    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.
    Please take the time to read the Forum FAQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •