Thank you Rick
Code2
works fine. It deducts the Break Time and displays the actual time worked. I am still studying your code to fully understand it and to learn from it. Thanks again for your help and direction.Code:Sub GetStartEndTime2() Dim StartTime As Date, EndTime As Date, BreakTime As Long, TimeDiff As String StartTime = ActiveCell.Value EndTime = Application.InputBox("Select the cell with the ending time...", Type:=8) BreakTime = 60 'Not sure how you plane to calculate 30 or 60, but it goes here TimeDiff = Format(EndTime - StartTime - TimeSerial(0, BreakTime, 0), _ "h"" hours and ""m"" minutes which excludes a " & BreakTime & " minute break.""") MsgBox "Start time: " & StartTime & vbLf & "End time: " & EndTime & vbLf & "Time difference: " & TimeDiff End Sub




Reply With Quote
Bookmarks