Sub Proposition1()
Dim ligne As Long
Dim AppartientSérie As Byte
Dim AB As Long
Range("F1") = "Résultat obtenu par la macro"
For ligne = 2 To 39
AppartientSérie = 0
[COLOR="Green"] 'Si A < B alors ...[/COLOR]
If Cells(ligne, 1) <= Cells(ligne, 2) Then
For AB = Cells(ligne, 1) To Cells(ligne, 2)
If AB = 10 Or AB = 11 Or AB = 12 Then
AppartientSérie = AppartientSérie + 1
End If
Next AB
Cells(ligne, 6) = Cells(ligne, 1) - Cells(ligne, 2) + AppartientSérie
End If
[COLOR="Green"] 'Si A > B alors ...[/COLOR]
If Cells(ligne, 1) > Cells(ligne, 2) Then
For AB = Cells(ligne, 2) To Cells(ligne, 1)
If AB = 10 Or AB = 11 Or AB = 12 Then
AppartientSérie = AppartientSérie + 1
End If
Next AB
Cells(ligne, 6) = Cells(ligne, 1) - Cells(ligne, 2) - AppartientSérie
End If
Next ligne
End Sub