Bonjour Yassdu782
Il faudrait peut-être commencer par vous former un peu à VBA
Votre question est la base de la programmation objet
Sub transformation()
Dim dLig As Long
Dim Tableau As Variant
' initialisations
dLig = Sheets("Feuil1").Range("A" & Rows.Count).End(xlUp).Row
Tableau = Sheets("Feuil1").Range("A1:M" & dLig)
'transformation
For lig = LBound(Tableau, 1) + 1 To UBound(Tableau, 1)
For col = UBound(Tableau, 2) To 3 Step -1 'on ignore les 2 premières colonnes
If Tableau(lig, col) > 0 And Tableau(lig, col - 1) > 0 Then 'si on a une suite
If Tableau(lig, col) > Tableau(lig, col - 1) Then
Tableau(lig, col) = Tableau(lig, col) - Tableau(lig, col - 1)
Else
Tableau(lig, col) = 0
End If
End If
Next col
Next lig
'export du résultat
Sheets("Feuil1").Range("Q1").Resize(UBound(Tableau, 1), UBound(Tableau, 2)).Value = Tableau
End Sub
A+