Sub traitement()
tablo = Sheets("Feuil1").Range("A3:D" & Sheets("Feuil1").Range("D" & Rows.Count).End(xlUp).Row)
ReDim tabfin(3, 0)
tabfin(0, UBound(tabfin, 2)) = Range("A2")
lignes = 0
ok = True
off = True
For n = LBound(tablo, 1) To UBound(tablo, 1)
If tablo(n, 4) = "oui" Then lignes = lignes + 1
If off And tablo(n, 3) <> "" Then
tabfin(2, UBound(tabfin, 2)) = tablo(n, 3)
off = False
End If
If tablo(n, 4) = "non" And tablo(n, 3) <> "" Then
If ok Then
tabfin(1, UBound(tabfin, 2)) = tablo(n, 3)
ok = False
End If
End If
If InStr(tablo(n, 1), "Cycle") <> 0 Then
tabfin(3, UBound(tabfin, 2)) = (lignes) / 2
lignes = 0
ReDim Preserve tabfin(3, UBound(tabfin, 2) + 1)
tabfin(0, UBound(tabfin, 2)) = tablo(n, 1)
ok = True
off = True
End If
Next
tabfin(3, UBound(tabfin, 2)) = lignes / 2
Sheets("Feuil2").Range("A2").Resize(UBound(tabfin, 2) + 1, UBound(tabfin, 1) + 1) = Application.Transpose(tabfin)
Sheets("Feuil2").Select
End Sub