Convert two times to "Hours Worked"

  • Thread starter Thread starter HotRod
  • Start date Start date
H

HotRod

Is there an easy way to convert 8:35 AM to 4:30 PM into the total number of
hours worked? Without changing it into 8:35 and 16:30 and then splitting the
numbers apart and doing the math?
 
Hi HotRod,

Apologies -momentary abberation!

Should have been:

Sub Test10()

Dim TotalHours As Double
Dim start As Double, finish As Double
finish = #4:30:00 PM#
start = #9:30:00 AM#

TotalHours = (finish - start) * 24
MsgBox TotalHours
End Sub
 
Ended up doing it the hard way by splitting it and then putting it back
together but I'll give this a try as well. THANKS
 
Hi HotRod,

Sub Test10()

Dim TotalHours As Double
Dim start As Double, finish As Double
finish = TimeValue("4:30PM")
start = TimeValue("9:30")

TotalHours = (finish - start) * 24
MsgBox TotalHours
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top