Bonjour à Tous,
J'ai écrit une petite Macro pour faire la somme des celulles non colorées d'une colonne et afficher le résultat dans la celulle ou j'ai lancé la Macro mais c'est la seule chose qui ne fonctionne pas, j'ai donc besoin d'un petit coup de main.
Merci par avance
🙂
Sub Macro2()
'
' Macro2 Macro
' Macro enregistrée le 30/12/2007 par Karczynski Valentin
' Touche de raccourci du clavier: Ctrl+t
'
Dim cell As Range, Somme As Double, ColorIndex As String, Colonne As Double, Rest As Double
Dim I As Integer, J As Integer, K As Integer, L As Integer, C As Integer
Dim CelCal As String
ColorIndex = -4142
Somme = 0
I = 0
CelCal = Selection.Address
L = Range(CelCal).Row
J = ActiveCell.Row
On Error Resume Next
Columns(3).Select
C = ActiveCell.Column
For Each cell In Selection.Cells
If cell.Interior.ColorIndex = ColorIndex Then Somme = Somme + _
cell.Value
J = cell.Row
I = I + 1
If I = L Then
Exit For
End If
Next cell
On Error GoTo 0
Set cell = Nothing
Range(CelCal).Select
MsgBox Somme
Range(Somme).Select.Paste
End Sub
Regarde la pièce jointe Classeur1.xls