Private Sub CommandButton1_Click()
Dim col As Integer, lig As Integer, mini As Integer, maxi As Integer
MyNote = "Voulez-vous inscrire récurence sur le mois au complet?"
mavariable3 = InputBox("Quelle est l'élément a ajouter? :")
Answer = MsgBox(MyNote, vbQuestion + vbYesNo, "Avant de procéder")
If Answer = vbYes Then
mini = 1
maxi = 31
Else
mavariable = InputBox("A partir de quelle date? :")
mini = CSng(mavariable)
mavariable2 = InputBox("Sur combien de jours? :")
maxi = CSng(mavariable2) + mini
End If
With ThisWorkbook.ActiveSheet
For col = 3 To 11 Step 2
For lig = 3 To 27 Step 6
If IsDate(.Cells(lig, col)) Then
dd = .Cells(lig, col).Value
If Day(dd) >= mini And Day(dd) <= maxi Then
.Cells(lig + 1, col + 1) = mavariable3
End If
End If
Next lig
Next col
End With
End Sub