TextBox in UserForm with 24h time format
One way:
Dim dblTime as Double
Dim lDays as long, lHours as long, lMinutes as long
dblTime = Format(Application.Sum(Range _
("A1:A10")), "hh:mm")
lDays = Int(dblTime)
lhours = hour(dblTime-int(dblTime))
lMinutes = minute(dblTime-int(dblTime))
Textbox1.Text = lDays*12+lHours & ":" & format(lMinutes,"00")
--
Regards,
Tom Ogilvy
"Mika" wrote in message
...
Hi,
I would like to sum up several time values from different
cells (more than 24 h) and output them into a TextBox
(UserForm).
The result should be 26:30 but the TextBox shows 09:30.
I tried it like:
TextBox1 = Format(Application.Sum(Range _
("A1:A10")), "hh:mm")
Unfortunately it doesn't work.
I tried it with the format [h]:mm but it shows :12.
Is there a possibility to get the needed formatting?
Thanks for your help,
Mika
|