Sub Test2()
Dim dico As Variant
Set dico = CreateObject("Scripting.Dictionary")
dateJ0 = Range("C16").Value
jours = Range("E16").Value
If jours = Empty Then
MsgBox "Remplir le nombre de jours"
Exit Sub
Else
For M = 0 To Range("I16").Value 'Nombre de répétitions
dico(dateJ0 + (M * jours)) = ("J " & (jours) * M)
Next M
End If
For Each e In dico.keys
x = x + 1
If x = 6 Then
T = T + 2
x = 1
End If
With Range("B19")
.Offset(T, x) = dico(e)
.Offset(T + 1, x) = e
.Offset(T, x).Interior.ColorIndex = 48
End With
Next e
End Sub