Sub Filtrer()
Dim rng As Range, i%, crit, tablo, dl%, tri%
crit = Array("Jour", "Varaint", "Type", "Chassi_Blouq", "Modul_Blouq", _
"Minut_Produc", "Minut_Produc", "Special")
With Sheets("Détail")
Set rng = .Range("A1:J" & .Range("A65000").End(xlUp).Row)
tablo = .Range("M3:U12").Value
End With
Application.ScreenUpdating = False
For i = 1 To UBound(tablo)
If UCase(tablo(i, 2)) = "YES" And UCase(tablo(i, 9)) = "YES" Then
Sheets.Add after:=Sheets(Sheets.Count)
With ActiveSheet
.Name = tablo(i, 1)
.Range("A1:H1") = crit
.Range("A2") = "'" & tablo(i, 3)
.Range("B2") = tablo(i, 5)
.Range("C2") = tablo(i, 4)
.Range("D2") = "N"
.Range("E2") = "N"
.Range("F2") = ">=" & tablo(i, 7)
.Range("G2") = "<=" & tablo(i, 8)
.Range("H2") = tablo(i, 9)
rng.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=.Range("A1:H2"), CopyToRange:=.Range("A5"), Unique:=False
.Rows("1:2").Cells.Clear
tri = IIf(tablo(i, 6) = "ASC", 1, 2)
dl = .Range("A65000").End(xlUp).Row
.Range("A5:J" & dl).Sort Key1:=.Range("H5"), Order1:=tri, Header:=xlYes
End With
End If
Next
Sheets("Détail").Activate
End Sub