Creating time difference box in VBA excel

cole516gray

New Member
Joined
Dec 2, 2013
Messages
6
Couple of things I want to do here...

1. I am working in military time, and need both the cb_starttime1 and cb_endtime1 to be entered as a four digit number hhmm, but display as hh:mm.

2. I then need the tb_timedifference1 to calculate the amount of hours spent on the job. I also want this box to show up in a decimal format (i.e. six and a half hours would show up as 6.5).

3. The tb_timedifference1 box must also be able to distinguish 24 hour periods, so I would need it to recognize that if cb_startime1 is 23:00 and cb_endtime1 is 5:00 then the tb_timedifference1 is 6.

Listed below are my boxes that need coding. I have tried so many things and finally just decided to erase all of it. Please help!

Private Sub cb_Starttime1_change()
End Function

Private Sub cb_Endtime1_change()
End Function

Private Sub tb_timedifference1_Change()
end Function
 

Some videos you may like

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Watch MrExcel Video

Forum statistics

Threads
1,099,543
Messages
5,469,337
Members
406,647
Latest member
ssinovec

This Week's Hot Topics

Top