1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Sub test()
Dim DtDeb As String, Del As String
Dim Dtmin As Byte, Dtheur As Byte, Dtjr As Byte, Dtmoi As Byte, Dtan As Byte
Dim Dljr As Byte, Dlheur As Byte, Dlmin As Byte
Dim DateDebut As Date, DateFin As Date
Dim Sep
Dim DurMin As Long, i As Long
For i = 2 To Cells(Rows.Count, 2).End(xlUp).Row
DtDeb = Range("J" & i).Value
Dtmin = CByte(Mid(DtDeb, Len(DtDeb) - 1))
Dtheur = CByte(Mid(DtDeb, Len(DtDeb) - 3, 2))
Dtjr = CByte(Mid(DtDeb, Len(DtDeb) - 5, 2))
Dtmoi = CByte(Mid(DtDeb, Len(DtDeb) - 7, 2))
Dtan = CByte(Left(DtDeb, Len(DtDeb) - 8))
DateDebut = DateSerial(Dtan, Dtmoi, Dtjr) + TimeSerial(Dtheur, Dtmin, 0)
Del = Range("B" & i).Value
Sep = Split(Del, ":")
Dljr = Val(Sep(0))
Dlheur = Val(Sep(1))
Dlmin = Val(Sep(2))
DurMin = Dlmin + 60 * Dlheur + 24 * 60 * Dljr
DateFin = DateAdd("n", DurMin, DateDebut)
Range("K" & i).Value = DateFin
Next i
End Sub |
Partager