Sub Trier()
Dim dercol%, P As Range, derlig&, lig&, j%, i&
Application.ScreenUpdating = False
With Sheets("aaaa")
dercol = .Cells(5, .Columns.Count).End(xlToLeft).Column
Set P = .Range("F4", .[F:F].SpecialCells(xlCellTypeFormulas)).Offset(, 1).Resize(, dercol - 6)
End With
derlig = P.Row + P.Rows.Count - 1
P.Rows(1) = "=SIGN(SUM(R[1]C:R" & derlig & "C ))"
P.Sort P.Rows(1), xlDescending, P.Rows(2), , xlAscending, Header:=xlNo, Orientation:=2 'tri horizontal
P.Rows(1).ClearContents 'RAZ
'---tableau de la feuille Synthèse---
With Sheets("Synthèse")
lig = 2
.Cells(lig, 1).Resize(.Rows.Count - lig + 1, 3).Delete xlUp 'RAZ
For j = 1 To dercol - 6
If Application.Count(P.Columns(j)) = 0 Then Exit For
.Cells(lig, 1) = P(2, j)
For i = 3 To derlig - 3
If IsNumeric(CStr(P(i, j))) Then
.Cells(lig, 2) = P(i, -4)
.Cells(lig, 3) = P(i, -5)
lig = lig + 1
End If
Next i, j
.[A1].CurrentRegion.Interior.Color = RGB(226, 239, 218) 'vert
.[A1:C1].Interior.Color = vbCyan
.Columns("A:C").AutoFit 'ajustement largeurs
End With
End Sub