PDA

View Full Version : Solved: Time format in Statusbar



perhol
12-06-2007, 08:44 AM
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:
Application.StatusBar = navn & " - TimeNorm = " & TN & " - Rulleplan = " & RP & " - Vagtplantimer = " & VP
TN - RP - VP is variables containing the time i want to show in [H]:mm-format.

xld
12-06-2007, 09:27 AM
Application.StatusBar = navn & " - TimeNorm = " & Application.Text(tn, "[h]:mm") & _
" - Rulleplan = " & Application.Text(RP, "[h]:mm") & _
" - Vagtplantimer = " & Application.Text(VP, "[h]:mm")

perhol
12-06-2007, 12:38 PM
Seames i was fokusing on the wrong line of code.

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

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

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

Thankyou for your effort. :friends: