Consulting

Results 1 to 3 of 3

Thread: Solved: Time format in Statusbar

  1. #1

    Solved: Time format in Statusbar

    I have made a working hours schedual for my work.
    I want the statusbar on some of the sheets to show 3 values collected from another sheet in same workbook.
    The code collect the wanted values and show them in the statusbar, but in a wrong format.
    The values is in the format [H]:mm, but is showing in standard format (ie. 148:00 becomes 6,16666666666667 in the statusbar).
    How can i make the values appear in the right format?

    This is the code for the statusbar:
    [vba]Application.StatusBar = navn & " - TimeNorm = " & TN & " - Rulleplan = " & RP & " - Vagtplantimer = " & VP[/vba]
    TN - RP - VP is variables containing the time i want to show in [H]:mm-format.

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

    Application.StatusBar = navn & " - TimeNorm = " & Application.Text(tn, "[h]:mm") & _
    " - Rulleplan = " & Application.Text(RP, "[h]:mm") & _
    " - Vagtplantimer = " & Application.Text(VP, "[h]:mm")
    [/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
    Seames i was fokusing on the wrong line of code.

    Yours work allright, i testet it, but here is what i did.

    This line:
    [VBA]TN = Sheets("Ansatte").Cells(Sheets("Ansatte").Range("A4:A41").Find(navn, LookIn:=xlValues).Row, 4)[/VBA]
    and 2 more like it, was collecting the times.

    I just added '.Text' to it, so now it lokks like this:
    [VBA]TN = Sheets("Ansatte").Cells(Sheets("Ansatte").Range("A4:A41").Find(navn, LookIn:=xlValues).Row, 4).Text[/VBA]
    and it works.

    Thankyou for your effort.

Posting Permissions

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