+ Reply to Thread
Results 1 to 3 of 3

listbox dispaying time in decimal format

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-30-2017
    Location
    texas
    MS-Off Ver
    2016
    Posts
    123

    listbox dispaying time in decimal format

    Greetings Everyone,

    I have a Userform that displays the time in a decimal format. I cannot figure out how to make it correctly display the time in the listbox. Please help! Thanks in advance for any input.

    Sincerely,
    David

    (See attached file)
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: listbox dispaying time in decimal format

    Your code is all over the place. Best thing I can do is to put a tempoary patch. In your UserForm_Initalize() procedure, add this lines to your code
    '// Format Time ColumnColumn
    For i = 0 To Me.LB_00.ListCount - 1
        Me.LB_00.List(i, 6) = Format(Val(Me.LB_00.List(i, 6)), "hh:mm:ss AM/PM")
    Next i
    So your full code will looks like
    Private Sub UserForm_Initialize()
    Dim i As Long
    
    CT_00.Value = WorksheetFunction.Max([NRs]) + 1  ' Row count
    'CT_08.List = Array("Male", "Female", "Trans", "Not Given", "Other")
    CT_08.List = [offloc_tbl].Value
    CT_10.List = [CaseDisp_tbl].Value
    CT_11.List = [AttSch_tbl].Value
    CT_12.List = [BehCode_tbl].Value
    CT_13.List = [ModGiven_tbl].Value
    CT_14.List = [EdLevel_tbl].Value
    CT_17.List = [YoP_tbl].Value
    'CT_13.List = [ET_tbl].Value
    'CT_15.List = [RO_tbl].Value
    'CT_16.List = Split("Yes No")
    'CT_20.List = Array("Cancer Patient", "Family member", "Carer", "Other Patient")
    'CT_21.List = [CT_tbl].Value
    'CT_23.List = Split("Yes No")
    'CT_26.List = Split("2 3 4")
    'CT_27.List = Array("Face to face (outreach)", "Face to face (home visits)", "Telephone", "Virtual")
    'CT_28.List = [BF_tbl].Value
    'CT_30.List = CT_28.List
    'CT_32.List = CT_28.List
    'CT_34.List = CT_28.List
    'CT_36.List = CT_28.List
    'CT_39.List = Array("Mand Recon", "Trib Att", "Trib Sup")
    With LB_00
            .List = [data_tbl].Value
            .ColumnCount = [data_tbl].CurrentRegion.Columns.Count
            
    ListTotals = Sheets("Lists").Cells.Range("M8").Value
    
    FilteredTotal.Value = LB_00.ListCount & " Item(s) Currently Showing In The Listbox"
    
    '// Format Time ColumnColumn
    For i = 0 To Me.LB_00.ListCount - 1
        Me.LB_00.List(i, 6) = Format(Val(Me.LB_00.List(i, 6)), "hh:mm:ss AM/PM")
    Next i
    
    End With
    
    End Sub

  3. #3
    Forum Contributor
    Join Date
    07-30-2017
    Location
    texas
    MS-Off Ver
    2016
    Posts
    123

    Re: listbox dispaying time in decimal format

    That is the fix! Many thanks. And yes the code is a mess, but a work in progress. I will pretty it up later. Thanks again for your help. It is greatly appreciated!

    David

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Time Conversion from Decimal time format
    By bigroo1958 in forum Excel General
    Replies: 2
    Last Post: 08-09-2016, 12:23 PM
  2. [SOLVED] Calculating Time worked in both decimal and time format.
    By danieloverton1984 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-19-2015, 07:11 AM
  3. How do i format time in decimal to hh:mm:ss
    By arciealba in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 07-31-2015, 02:53 AM
  4. Converting time in hh:mm:ss format to decimal format
    By shanekerr in forum Excel General
    Replies: 4
    Last Post: 05-28-2015, 03:25 AM
  5. [SOLVED] Converting an elapsed time in decimal number format to an actual time :S
    By Spicey_888 in forum Excel General
    Replies: 3
    Last Post: 07-20-2014, 08:53 PM
  6. Display time in time format instead of decimal format
    By CasualVisitor in forum Excel General
    Replies: 5
    Last Post: 07-03-2009, 06:24 PM
  7. Convert time format to a decimal
    By Michele in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-17-2006, 03:00 PM

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