Salut,
voici le code
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim aa As String, bb As String, Status As String, Paye As Integer, Ct As Integer
Range("B2").Select
Selection.CurrentRegion.Sort Key1:=[B1], Key2:=[F1], Header:=xlYes
Paye = 0
Ct = 0
Do Until IsEmpty(ActiveCell)
aa = ActiveCell & ActiveCell.Offset(, 4)
bb = ActiveCell.Offset(1, 0) & ActiveCell.Offset(1, 4)
Status = ActiveCell.Offset(, 4)
Paye = Paye + ActiveCell.Offset(, 3)
Ct = Ct + 1
If aa <> bb Then
If Status = "en droit" Then
ActiveCell.Offset(, 6) = Ct
Ct = 0
ActiveCell.Offset(, 10) = Paye
Paye = 0
ElseIf Status = "en tort" Then
ActiveCell.Offset(, 7) = Ct
Ct = 0
ActiveCell.Offset(, 10) = Paye
Paye = 0
ElseIf Status = "seul" Then
ActiveCell.Offset(, 9) = Ct
Ct = 0
ActiveCell.Offset(, 10) = Paye
Paye = 0
Else
ActiveCell.Offset(, 8) = Ct
Ct = 0
ActiveCell.Offset(, 10) = Paye
Paye = 0
End If
End If
ActiveCell.Offset(1, 0).Select
Loop
Application.ScreenUpdating = True
End Sub
Si pour toi, ceci n'est qu'un grand charabia, alors inutile de passer aux explications, le plus simple serait de recopier tes données (au même format !!!) sur la page et de lancer la macro