+ Reply to Thread
Results 1 to 8 of 8

Time format > 24 hours

  1. #1
    Registered User
    Join Date
    05-01-2013
    Location
    Cov, England
    MS-Off Ver
    Excel 2003
    Posts
    60

    Time format > 24 hours

    hi i have a text-box on my user form where duration is entered. these durations are higher than a 24 hour clock i.e 77:55:21 or even as high as 453:45:33, in excel i can use [h]:mm:ss but this doesn't work in VBA

    is there a VBA format code for this?

    please help

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    8,803

    Re: Time format > 24 hours

    Try something like this...

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-01-2013
    Location
    Cov, England
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: Time format > 24 hours

    Hi, Thanks for replying
    unfortunately I'm Not able to get the code to work without is causing an error.

    I need it more as a text box format than a data entry as it pulls the times from a worksheet but its displaying them as 12.5 rather than 300:00:00 (Excel sheet format [h]:mm:ss)

    any ideas?

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    8,803

    Re: Time format > 24 hours

    You want to read the time from a cell into the TextBox?

    Can you show your code?

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    10,765

    Re: Time format > 24 hours

    You should post the code you are using that does not work.
    Ben Van Johnson

  6. #6
    Registered User
    Join Date
    05-01-2013
    Location
    Cov, England
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: Time format > 24 hours

    Have attached the workbook

    On my user form i have 2 "Idle Time" one for adding data and one for amending data

    on the amend tab you select the date and time and it draws the data from the work sheet "IdleTime"

    I formatted the textboxs that show time with format(Textbox#, "hh:mm AMPM") but cannot find a format that will display duration over 24 hours i.e as above 300:00:00 (on sheet) shows as 12.5 in textbox
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    8,803

    Re: Time format > 24 hours

    Try this...

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-01-2013
    Location
    Cov, England
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: Time format > 24 hours

    worked perfect, Thanks so much

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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