Bonjour,
Finir une macro ? Ben, où qu'il est ton code ?
Une proposition :
Option Explicit
Dim K As Integer, J As Integer
Sub Proposition()
Dim lR As Integer, fR As Integer
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
fR = 0
Purge
With Sheets("Tableau de suivi marchés")
For K = 6 To .UsedRange.Rows.Count
If .Cells(K, 1).Interior.Color = 16777164 Then
If fR = 0 Then
fR = .Cells(K + 1, 1).Row
Else
lR = .Cells(K - 1, 1).Row
.Cells(lR + 1, 1) = " "
For J = 2 To .UsedRange.Columns.Count
.Cells(fR - 1, J).Formula = "=SUM(" & Range(.Cells(fR, J), .Cells(lR, J)).Address & ")"
Next J
fR = .Cells(K + 1, 1).Row
lR = 0
End If
End If
Next K
End With
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Sub Purge()
With Sheets("Tableau de suivi marchés")
For K = 6 To .UsedRange.Rows.Count
If .Cells(K, 2).Formula Like "=SUM*" Then
For J = 2 To .UsedRange.Columns.Count
.Cells(K, J).ClearContents
Next J
End If
Next K
End With
End Sub