Sub ventiler()
Dim ts As ListObject, i&, j&, i1&, i2&, n&, t, t1, t2
Application.ScreenUpdating = False
Set ts = Worksheets("BDD").Range("a1").ListObject: n = ts.ListColumns.Count
On Error Resume Next
i = 0: i = Worksheets("Fabricant1").Range("a1").CurrentRegion.Clear
If i = 0 Then Worksheets.Add: ActiveSheet.Name = "Fabricant1"
Worksheets("Fabricant1").Columns(1).Resize(, n).Clear
i = 0: i = Worksheets("Fabricant-autres").Index
On Error GoTo 0
If i = 0 Then Worksheets.Add: ActiveSheet.Name = "Fabricant-autres"
Worksheets("Fabricant-autres").Columns(1).Resize(, n).Clear
t = ts.Range: t1 = ts.Range: t2 = ts.Range: i1 = 1: i2 = 1
For i = 2 To UBound(t)
If t(i, 16) = "Fabricant1" Then
i1 = i1 + 1
For j = 1 To n: t1(i1, j) = t(i, j): Next
Else
i2 = i2 + 1
For j = 1 To n: t2(i2, j) = t(i, j): Next
End If
Next i
With Worksheets("Fabricant1")
.Range("a1").Resize(i1, n) = t1
.ListObjects.Add(xlSrcRange, .Range("a1").Resize(i1, n), , xlYes).Name = "tsFab1"
.ListObjects("tsFab1").TableStyle = "TableStyleMedium7"
End With
With Worksheets("Fabricant-autres")
.Range("a1").Resize(i2, n) = t2
.ListObjects.Add(xlSrcRange, .Range("a1").Resize(i2, n), , xlYes).Name = "tsFabN"
.ListObjects("tsFabN").TableStyle = "TableStyleMedium5"
End With
End Sub