problème pour Nb cellules en couleur

J

j-marc

Guest
Bonsoir à tous

voila mon petit problème:
j'utilise cette macro pour compter les cellules d'une certaine couleur mais je voudrais ignorer dans le compte les cellules dont la valeur est "A"

Private Sub CommandButton1_Click()
For l = 6 To Range("B6").End(xlDown).Row
a = 0

For Each Cell In Range("B" & l & ":AF" & l)
If Cell.Interior.ColorIndex = Range("AH3").Interior.ColorIndex Then a = a+1
Next Cell
Range("AH" & l) = a
Next l

merci pour votre aide et conseil
 
L

léa

Guest
Bonsoir Jean Marc,

Je n'ai pas essayé, mais est ce quette ligne te conviendrait ?

If Cell.Interior.ColorIndex = Range("AH3").Interior.ColorIndex And Range("B" & l & ":AF" & l).Value <> "A" HThen a = a+1

Bonne soirée
Léa
 
P

Pascal76

Guest
Bonjour

sur cette ligne

If Cell.Interior.ColorIndex = Range("AH3").Interior.ColorIndex Then a = a+1

tu modifies en

If Cell.Interior.ColorIndex = Range("AH3").Interior.ColorIndex and cell.value <>"A" Then a = a+1

Bonne soirée

Pascal
 

Discussions similaires

Statistiques des forums

Discussions
312 558
Messages
2 089 597
Membres
104 221
dernier inscrit
legendking85