Bonjour Spark, fanfan38, le forum,
Une variante....à tester....
Option Explicit
Option Base 1
Sub test()
Dim tb, ntb(), wsh
Dim i%, k%, j%, x%, dl%
Dim rcell As Range
tb = Sheets("2023").ListObjects(1).DataBodyRange
wsh = Array("Param1", "Param2", "Param3", "Param4", "Param5")
Application.ScreenUpdating = False
For i = 1 To UBound(wsh)
k = 0
ReDim ntb(1 To UBound(tb, 1), 1 To 4)
For j = 1 To UBound(tb, 1)
If UCase(tb(j, i + 4)) Like "OUI" Then
For x = 1 To 4: ntb(k + 1, x) = tb(j, x): Next x
k = k + 1
End If
Next j
With Sheets(wsh(i)).ListObjects(1)
If Not .DataBodyRange Is Nothing Then .DataBodyRange.Delete
If .InsertRowRange Is Nothing Then
Set rcell = .HeaderRowRange.Cells(1).Offset(.ListRows.Count + 1)
Else
Set rcell = .InsertRowRange.Cells(1)
End If
End With
If k > 0 Then rcell.Resize(k, 4) = ntb: Erase ntb
Next i
Erase tb: Set rcell = Nothing: MsgBox "Traitement effectué", vbInformation
End Sub
Cordialement,