LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default working with hours in xs of 24

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Working hours Fredrik Excel Discussion (Misc queries) 1 April 6th 10 08:13 PM
Working hours average Aviral Sharma Excel Discussion (Misc queries) 1 March 9th 09 10:00 AM
Working out hours Nicola22 Excel Discussion (Misc queries) 2 March 3rd 09 02:00 PM
working hours Michel B. Excel Worksheet Functions 2 March 9th 06 05:18 PM
Working hours Hani Muhtadi Excel Discussion (Misc queries) 1 September 13th 05 09:48 PM


All times are GMT +1. The time now is 11:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"