'Bouton Trier
Private Sub CommandButton1_Click()
If ComboBox1 = "" Then ComboBox1.DropDown: Exit Sub
If ComboBox2 = "" Then ComboBox2.DropDown: Exit Sub
Dim dest As Range
Application.ScreenUpdating = False
Set dest = Feuil2.Range("A" & Feuil2.[B65536].End(xlUp).Row + 1)
[K2] = "=AND(B2=""" & ComboBox1 & """,F2=""" & ComboBox2 & """)"
With Range("A1:J" & [B65536].End(xlUp).Row)
.AdvancedFilter xlFilterInPlace, [K1:K2] 'filtre avancé
On Error Resume Next 'si aucune donnée filtrée
.Offset(1).Resize(.Rows.Count - 1).SpecialCells(xlCellTypeVisible).Copy dest
.AdvancedFilter xlFilterInPlace, ""
End With
[K2] = ""
If Err = 0 Then
dest(1, 11) = ComboBox1 'colonne K
dest(1, 12) = ComboBox2 'colonne L
dest.Parent.Activate 'facultatif
Unload UserForm1
End If
Application.ScreenUpdating = True
If Err Then MsgBox "Aucune donnée filtrée..."
End Sub