Consulting

Results 1 to 3 of 3

Thread: Countdown between dates

  1. #1
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,198
    Location

    Countdown between dates

    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



    George
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2403, Build 17425.20146

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]


    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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Attached a possible start.
    Needs some cleaning and changes but see what you think.

    HTH

    John

Posting Permissions

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