Option Explicit
Sub TheRecuperator()
Dim TimeStart As Long
Dim Tablo As Variant
Dim Tablo2() As String
Dim Item As Variant
Dim L As Integer
Dim C As Byte
Dim x As Integer, i As Integer, j As Integer, k As Integer
TimeStart = Timer
With Sheets('W')
Tablo = .Range('E1:H' & .Range('a65536').End(xlUp).Row) '<=== à adapter
End With
For i = 1 To UBound(Tablo)
For j = 1 To 4
For Each Item In Array('St AGNES', 'SIIS', 'GEPSA', 'ETAPE')
If Not IsError(Tablo(i, j)) Then
If Tablo(i, j) = Item Then
ReDim Preserve Tablo2(5, x)
For k = 0 To 3
Tablo2(k, x) = Tablo(i, k + 1)
Next k
Tablo2(4, x) = Item
x = x + 1
End If
End If
Next Item
Next j
Next i
For i = 0 To UBound(Tablo2, 2)
For Each Item In Array('St AGNES', 'SIIS', 'GEPSA', 'ETAPE')
If Tablo2(4, i) = Item Then
With Sheets(Item)
L = .Range('A5000').End(xlUp).Row + 1
For C = 0 To 3
.Cells(L, C + 1) = Tablo2(C, i)
Next
End With
End If
Next Item
Next i
MsgBox 'Durée d'Exécution ' & Timer - TimeStart
End Sub