Sub timenamecompare()
Dim lr, i, j, lrn, u As Long
Dim Rng, rngr, x As Range
Dim sht As String
lr = Cells(Rows.Count, "I").End(xlUp).Row
sht = "sheet1"
Set Rng = Range("A1:R" & lr)
Set rngr = Range("R2:R" & lr - 1)
For Each x In rngr
If x.Value = x.Offset(1, 0).Value And _
Abs(DateDiff("n", Format((x.Offset(0, -9).Value & " " & Format(x.Offset(0, -7).Value, "HH:MM")), "dd-mm-yy HH:MM"), Format((x.Offset(1, -9).Value & " " & Format(x.Offset(1, -7).Value, "HH:MM")), "dd-mm-yy HH:MM"))) < (1440) _
And Abs(DateDiff("n", Format((x.Offset(0, -9).Value & " " & Format(x.Offset(0, -7).Value, "HH:MM")), "dd-mm-yy HH:MM"), Format((x.Offset(1, -9).Value & " " & Format(x.Offset(1, -7).Value, "HH:MM")), "dd-mm-yy HH:MM"))) <> 0 Then
x.Offset(1, -14).Value = "Y"
End If
Next
End Sub