Private Sub CommandButton1_Click()
mydatedebut = DTPicker1.Value
mydatefin = DTPicker2.Value
MsgBox "mydatedebut" & mydatedebut
MsgBox "mydatefin" & mydatefin
' Dans le cas où le choix est effectué sur le DTPicker1
If mydatefin <= mydatedebut Then
MsgBox "La date de fin ne peut être inférieure à la date de début"
DTPicker1.SetFocus
Else
Unload Me
' Mise en place des données dans la feuille BaseCongés
For Each cell In Range("a7:a33") 'agents
If cell.Value = Me.ComboBox1.List(Me.ComboBox1.ListIndex) Then
rang = cell.Row
MsgBox "rang " & rang
Worksheets("4ème trimestre").Activate
For Each cellule In Range("i6:CU6") 'dates jour mois année du calendrier
If cellule.Value > mydatedebut - 1 And cellule.Value <= mydatefin Then
MsgBox "cellule.Value" & cellule.Value
col = cellule.Column
MsgBox "rang" & rang & " col" & col
Cells(col & ", " & rang).Select
MsgBox Cells(col & ", " & rang).value & " " & Cells(col & ", " & rang).Address
'With Selection.Interior
' .ColorIndex = 35
' .Pattern = xlSolid
'End With
End If
Next cellule
End If
Next cell
End If
End Sub