Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
TextBox in UserForm with 24h time format
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date Format for Userform TextBox | New Users to Excel | |||
TextBox on a userform - format to currency & percent | Excel Discussion (Misc queries) | |||
format textbox in userform | Excel Programming | |||
Format of a TextBox in a userform | Excel Programming | |||
Qn: Date Format in TextBox in UserForm? | Excel Programming |