Sub Remplissage()
Range("a2", "j500").ClearContents
Dim Début As Date, Fin As Date, DateIntermédiaire As Date, Hauteur As Integer, I As Integer
On Error GoTo Sortie
Début = InputBox("Date de début ?")
Fin = InputBox("Date de fin ?")
On Error GoTo 0
If Fin < Début Then Exit Sub
DateIntermédiaire = Début
Hauteur = ((Month(Fin) + Year(Fin) * 12) - (Month(Début) + Year(Début) * 12)) / 3
If Hauteur <> Int(Hauteur) Then Hauteur = Int(Hauteur) + 1
For I = 2 To Hauteur + 1
Cells(I, 3) = DateIntermédiaire
Cells(I, 6) = DateAdd("m", Hauteur, DateIntermédiaire)
Cells(I, 9) = DateAdd("m", Hauteur * 2, DateIntermédiaire)
DateIntermédiaire = DateAdd("m", 1, DateIntermédiaire)
Next I
For I = 2 To Hauteur + 1
If Month(Cells(I, 3)) = Month(Début) Then Cells(I, 1) = Year(Cells(I, 3)) - Year(Début)
If Month(Cells(I, 6)) = Month(Début) Then Cells(I, 5) = Year(Cells(I, 6)) - Year(Début)
If Month(Cells(I, 9)) = Month(Début) Then Cells(I, 8) = Year(Cells(I, 9)) - Year(Début)
Next I
Exit Sub
Sortie: Exit Sub
End Sub