Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
On a timesheet form I collect start and end times, I want to display the hours against each day (no problems) and I want to show the running total, for visual error checking. In a cell I would use the format [h]:mm but this doesn't work in VBA, d1 & d2 = "18:00:00" format(d1+d2,"[h]:mm") gives :12 take out the [] and I get 31/12/1899 12:00:00 and what I want is to display 36:00 in a lable I've been trying to convert the value in the lable, but I can't do Csng(lbl) the function won't convert a String to a Single. How can I get around this? Cdate() checks for a valid date format and then does a conversion, so if the hours are <24 if d1="18:00" I can do x= Csng(Cdate(d1)) and get x=18 but it doesn't work if d1="36:00" I'm open to alternative suggestions, but I'd rather not have to write an interim value back to the spreadsheet, just seems clumsy. TIA |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Working hours | Excel Discussion (Misc queries) | |||
Working hours average | Excel Discussion (Misc queries) | |||
Working out hours | Excel Discussion (Misc queries) | |||
working hours | Excel Worksheet Functions | |||
Working hours | Excel Discussion (Misc queries) |