1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Sub DateAnter()
'DateAnter Macro
Dim Result As Long
Dim i As Long
Dim j As Long
For i = 2 To (Cells(Rows.Count, 1).End(xlUp).Row) - 1
j = i + 1
Date1 = CDate(Left(Replace(Cells(i, "D"), "-", "/"), 19)) 'Transformer les dates format perso en format accepté par excel
Date2 = CDate(Left(Replace(Cells(j, "C"), "-", "/"), 19))
Result = Date2 - Date1 '****************
If Result < 0 And Cells(i, "B") = Cells(j, "B") Then
MsgBox Date1
MsgBox Date2
MsgBox Result
MsgBox "Chevauchement"
Exit Sub
End If
Next
End Sub |