voici la macro et le fichier
Sub Filtre()
Dim J As Long, Nblg As Long
Dim Ws As Worksheet
Dim Tablo()
Dim I As Integer, Indice As Integer
Application.ScreenUpdating = False
Set Ws = ActiveSheet
If Ws.FilterMode = True Then Ws.ShowAllData
Nblg = Range("F" & Rows.Count).End(xlUp).Row
ReDim Tablo(0)
For J = 3 To Nblg
For I = 0 To UBound(Tablo)
If Tablo(I) = Range("F" & J) Then Exit For
Next I
If I > UBound(Tablo) Then
ReDim Preserve Tablo(Indice)
Tablo(Indice) = Range("F" & J)
Indice = Indice + 1
End If
Next J
Range("M2") = Range("F2")
For I = 0 To UBound(Tablo)
Ws.Range("M3") = Tablo(I)
If FeuilleExiste(CStr(Tablo(I))) = False Then
Sheets.Add(after:=Sheets(Sheets.Count)).Name = Tablo(I)
End If
With Sheets(Tablo(I))
.Cells.Clear
Ws.Range("A6:I" & Nblg).AdvancedFilter Action:=xlFilterCopy, criteriarange:=Ws.Range("M2:M3"), copytorange:=.Range("A1:I1")
End With
Next I
With Ws
.Range("M2:M3").ClearContents
.Select
End With
End Sub
Function FeuilleExiste(Nom As String) As Boolean
On Error Resume Next
FeuilleExiste = Sheets(Nom).Name <> ""
On Error GoTo 0
End Function
macro au cas ou
et feuille
là c'est sur tu dois avoir la macro avec