Re le forum
Désolé mauvais fichier voila le bon
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim colonne As Byte, rang As Long, a As Long
Dim vert As Integer, jaune As Integer, rouge As Integer
Dim somme_vert As Double, somme_jaune As Double, somme_rouge As Double
vert = 0: somme_vert = 0
jaune = 0: somme_jaune = 0
rouge = 0: somme_vert = 0
For colonne = 2 To 11
For rang = 7 To 14
a = Cells(rang, colonne).Interior.ColorIndex
'Compte le nombre de cellules d'une couleur
If a = 4 Then vert = vert + 1
If a = 6 Then jaune = jaune + 1
If a = 3 Then rouge = rouge + 1
'Fait la somme des valeurs de cellules d'une couleur
If a = 4 Then somme_vert = somme_vert + Cells(rang, colonne).Value
If a = 6 Then somme_jaune = somme_jaune + Cells(rang, colonne).Value
If a = 3 Then somme_rouge = somme_rouge + Cells(rang, colonne).Value
Next rang
Next colonne
Cells(15, 2).Value = vert: Cells(15, 2).Interior.ColorIndex = 4
Cells(16, 2).Value = jaune: Cells(16, 2).Interior.ColorIndex = 6
Cells(17, 2).Value = rouge: Cells(17, 2).Interior.ColorIndex = 3
Cells(20, 2).Value = somme_vert: Cells(20, 2).Interior.ColorIndex = 4
Cells(21, 2).Value = somme_jaune: Cells(21, 2).Interior.ColorIndex = 6
Cells(22, 2).Value = somme_rouge: Cells(22, 2).Interior.ColorIndex = 3
End Sub
Desolé Mytå