Private Sub CommandButton1_Click() 'valider
Dim Cel As Range, C As Byte, DerL As Integer, Ld As Integer
Dim DateDebut As Long
Dim DateFin As Long
Dim Ligne_Depart As Integer, L As Integer
Dim Ligne_Fin As Integer
Dim Col As Byte, Col_Tab As Integer
Dim Tabtemp As Variant
Ld = 6
Application.ScreenUpdating = False
With Sheets("Base Agent")
DerL = .Range("O65536").End(xlUp).Row
Set Cel = .Rows(1).Find(UserForm1.ComboBox1.Value)
If Not Cel Is Nothing Then
DateDebut = Format(UserForm1.CmbB_Datedebut.Column(1, UserForm1.CmbB_Datedebut.ListIndex), "00000")
DateFin = Format(UserForm1.CmbB_Datefin.Column(1, UserForm1.CmbB_Datefin.ListIndex), "00000")
C = Cel.Column
Tabtemp = .Range(.Cells(Ld, 15), .Cells(DerL, C)).Value
Col_Tab = UBound(Tabtemp, 2) - 2
For L = 1 To UBound(Tabtemp, 1)
If Format(Tabtemp(L, 1), "00000") <= DateFin And Format(Tabtemp(L, 1), "00000") >= DateDebut Then
.Cells(5 + L, C - 1) = UserForm1.ComboBox2
.Cells(5 + L, C) = UserForm1.ComboBox3
.Cells(5 + L, C + 1) = UserForm1.ComboBox4
End If
Next
UserForm1.ComboBox2.ListIndex = -1
UserForm1.ComboBox3.ListIndex = -1
UserForm1.ComboBox4.ListIndex = -1
UserForm1.CmbB_Datedebut.ListIndex = -1
UserForm1.CmbB_Datefin.ListIndex = -1
End If
End With
Application.ScreenUpdating = True
End Sub