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
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,214,596
Messages
6,120,438
Members
448,966
Latest member
DannyC96

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top