+ Reply to Thread
Results 1 to 4 of 4

Elapsed times greater than 24hrs

Hybrid View

  1. #1
    Registered User
    Join Date
    08-03-2009
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    19

    Elapsed times greater than 24hrs

    I have the following code that runs a timer which is displayed in a form. I want the timer to go past 24 hours. I have tried putting the format as "[hh]:mm:ss" but when I do this then the hours disappear and the timer starts at 8 minutes for some reason regardless of what the time in cell b6 is.
    The time saved in cell b6 is the time the race starts.

    Sub RClock1()
    
    Watch = Now - Sheets("Timing Sheet").Range("B6")
    UserForm1.RaceClock1.Text = Format(Watch, "hh:mm:ss")
    NextTick = Now + TimeValue("00:00:01")
    Application.OnTime NextTick, "RClock1"
    End Sub
    Thanks for your help
    Last edited by NDBC; 08-03-2009 at 08:40 PM.

  2. #2
    Registered User
    Join Date
    08-03-2009
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Elapsed times greater than 24hrs

    An update of my progress. I must admit I have asked for help on another forum. See here http://www.microsoft.com/office/comm...4-8aa2f49abacf

    It was suggested by Jacob Skaria to try this code
    Sub RClock1()
    
    Watch = Now - Sheets("Timing Sheet").Range("B6")
    UserForm1.RaceClock1.Text = Worksheetfunction.text(Now - _
    Sheets("Timing Sheet").Range("B6"),"[h]:mm:ss")
    NextTick = Now + TimeValue("00:00:01")
    Application.OnTime NextTick, "RClock1"
    End Sub
    When I do the hours start at 960696. ie the timer starts at 960696:00:00.

    Now 960696 = 40,029 days = 109.67 years so I'm guessing it is giving me the elapsed time since the start date in excel 1/1/1900.

    Can anybody help me to get it to start at zero.

    Thanks

  3. #3
    Registered User
    Join Date
    08-03-2009
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    19

    Re: Elapsed times greater than 24hrs

    What I have done now is save the race start time in cell b6 using now and the format "d/mm/yyyy hh:mm:ss" and re-started the timer. The timer now starts at 2832:00:00.

    2832/24 = 118 days. Now I am lost. We are up to day 216 of the year so I can't figure out where the elapsed time is working from. I think it's got me beat.

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Elapsed times greater than 24hrs

    Not sure what the problem is in your sheet, but in my test sheet it the code seems to be working just fine.

    If you can, upload a copy of your sheet and we can test directly in what you're working with.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1