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
|
Sub NextMonths()
Dim j As Integer
Dim moisTraite As Variant
Dim myRng As String
moisTraite = InputBox("Quel est le mois traîté ? :", "Mois Traîé", Month(Now))
If moisTraite = "" Or Val(moisTraite) <= 0 Or moisTraite > 12 Then Exit Sub
ThisWorkbook.Sheets("Paramètres").[k1] = CLng(moisTraite)
If CLng(moisTraite) = 12 Then moisTraite = 0
With ThisWorkbook.Sheets("Paramètres").Range("J2:J20")
.ClearContents
For j = 1 To 12
If moisTraite + j < 13 Then Cells(j + 1, 10) = moisTraite + j
Next j
End With
myRng = "$J$2:" & Cells(Rows.Count, 10).End(xlUp).Address
UserForm1.Controls("ComboBox1").RowSource = myRng
UserForm1.Show
End Sub |
Partager