Private Sub Worksheet_Activate()
For c = Cells(2 ^ 16, 4).End(xlUp).Row To Cells(14, 4).Row Step -1
If Cells(c, 4) = "CT" Then
Cells(8, 3) = DateSerial(Year(Cells(c, 1)) + 1, Month(Cells(c, 1)), Day(Cells(c, 1)))
GoTo Révision
End If
Next c
Cells(8, 3) = DateSerial(Year(Cells(4, 5)) + 1, Month(Cells(4, 5)), Day(Cells(4, 5)))
Révision:
For r = Cells(2 ^ 16, 4).End(xlUp).Row To Cells(14, 4).Row Step -1
If Cells(r, 4) = "Révision" Then
Cells(8, 6) = ((Cells(r, 2) + 30000) \ 30000) * 30000
Exit Sub
End If
Next r
Cells(8, 6) = ((Cells(5, 5) + 30000) \ 30000) * 30000
End Sub