Add this line of code
Cells(i, 5).FormulaR1C1 = "=SUM(RC[-1]-RC[-2])*24"
below
Cells(i, 4) = Time
in clock out code to work out duration