Re : Calendrier: Incrémenter congé d'une semaine sur deux mois combobox
Bonjour,
J'ai modifié la procédure CmbOk_click comme suit :
Je ne pense pas que cela résolve complètement ton problème. Toutefois, cela peut t'inspirer une solution.
Tu peux adapter la procédure de suppression de la même façon
Private Sub CmbOK_Click()
Dim Indice As Byte, Jour As Byte
Stop
If ComboBox1.Value = "" Then
MsgBox "Veuillez faire une saisie"
Else
ActiveCell.Value = ComboBox1
col = ActiveCell.Column
ligne = ActiveCell.Row
If Me.CheckBox1 = True And Weekday(ActiveCell.Offset(0, -1), vbMonday) = 1 Then
If Me.ComboBox1 = "CP" Then Jour = 6 Else Jour = 5
For i = 1 To Jour
If Cells(ligne, col - 1) <> "" Then
Cells(ligne, col) = Me.ComboBox1
ligne = ligne + 1
GoTo suite
End If
If Cells(ligne, col - 1) = "" Then
ligne = 17
col = col + 4
Cells(ligne, col) = Me.ComboBox1
ligne = ligne + 1
End If
suite:
Next i
End If
Do
ActiveCell.Offset(Indice) = Me.ComboBox1
Indice = Indice + 1
a = Weekday(ActiveCell.Offset(Indice, -1), vbMonday)
Loop Until Weekday(ActiveCell.Offset(Indice, -1), vbMonday) > Jour Or Not IsDate(ActiveCell.Offset(Indice, -1))
Unload UserForm1
End If
End Sub