[Aide] Somme en fonction couleur cellule décalée

Bonjour,

J'ai besoin de vous aujourd'hui pour terminer ma macro.

Dans l'exemple que je donne il faudrait réussir à faire les sommes (Cellules vides après couleurs bleue en colonne A).

En sachant que les cellules bleus peuvent bouger sur toute la colonne A.

Si vous avez besoin de plus de précisions n'hésitez pas

11exemple.zip (26.20 Ko)

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
Rechercher des sujets similaires à "aide somme fonction couleur decalee"