Good Morning,
I have a issue in some logic I was hoping someone can point me in the right direction.
My Script pulls a start time and a end time via a min and max formula I then subtract these times to get working hours. I format the cell as "hh:mm:ss"
The cell value shows the time in "hh:mm:ss"
However the logic I'm using below looks at this cells time to determine how many hours they worked. in the example attached the person only worked 00:00:42 seconds so that is well under the 04:00:00 time yet the script walks right past this line.
So I placed a msgbox in the script to see what the value being returned was and it's a decimal.
Now How can I get the script to react to the time and not the decimal?
Range("B6").FormulaR1C1 = "=min(R[16]C[8]:R" & lrow & "C[8])"
Range("B7").FormulaR1C1 = "=max(R[15]C[8]:R" & lrow & "C[8])"
Range("B8").FormulaR1C1 = "=R[-1]C-R[-2]C"
Range("B8").NumberFormat = "hh:mm:ss"
'NEED TO ADJUST BREAK TIMES
Msgbox Range("b8").Value 'REMOVE THIS
'If Range("B8").Value < ".166666666666667" Then
If Range("B8").Value <= "04:00:00" Then
Range("A9").Value = "00:15:00"
ElseIf Range("B8").Value >= "04:00:00" And Range("B8").Value <= "08:00:00" Then
Range("A9").Value = "00:45:00"
ElseIf Range("B8").Value > "08:00:00" And Range("B8").Value <= "12:00:00" Then
Range("A9").Value = "01:00:00"
ElseIf Range("B8").Value > "12:00:00" Then
Range("A9").Value = "01:15:00"
End If
Bookmarks