reconnaissance couleur d'une cellule

stefgand

XLDnaute Nouveau
Bonjour à tous,

sur ma feuille j'ai une centaine de cellule qui sont en jaune et je souhaite faire une requête pour savoir combien il y a de commentaires de renseignés sur cette centaine de cellule.

Merci de m'apporter votre aide.
 

Hervé

XLDnaute Barbatruc
bonjour

en piece jointe une proposition vba.

salut [file name=Classeur2_20060117102826.zip size=8519]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/Classeur2_20060117102826.zip[/file]
 

Pièces jointes

  • Classeur2_20060117102826.zip
    8.3 KB · Affichages: 48

Hervé

XLDnaute Barbatruc
re stefgand

J'ai pas bien compris ce que tu voulais dire par :

'isoler une colonne pour reconnaître la couleur des cellules dans cette
colonne.'

si tu ne veux travailler que sur la cellule F par exemple :

remplace :For Each c In ActiveSheet.UsedRange

par : For Each c In Range('f1:f' & Range('f65536').End(xlUp).Row)


salut
 

stefgand

XLDnaute Nouveau
Hervé,

en fait dans ma colonne B j'ai une centaine de celulle de couleur jaune et toutes les autres sont avec un fond normal.

ce que je souhaite c'est savoir s'il y a un commentaire dans mes cellules jaunes et uniquement dans la colonne B.

j'ai fait ta manip avec la colonne F mais ça ne marche pas.
 

stefgand

XLDnaute Nouveau
hervé,

juste une précision car je me suis mal exprimé.
en fait ce n'est pas un commentaire mais des caractères. exple : a recontacter

j'ai essayé ta méthode avec un commentaire et ça marche nickel.

peux tu me dire comment modifier commentaire par caractère dans VB

merci encore
 

Hervé

XLDnaute Barbatruc
re

y'a t'il des données en colonne B, ou seulement des couleurs.

si il a des données :

For Each c In Range('b1:b' & Range('b65536').End(xlUp).Row)

devrait fonctionner

sinon, merci de nous joindre un fichier de ce que tu as.

salut
 

Hervé

XLDnaute Barbatruc
re

nos messages se sont croisées.

ce n'est donc plus des commentaires.

alors, ce code compte dans la colonne B combien de cellule jaune comporte 'a recontacter' :


Sub Bouton1_QuandClic()
Dim c As Range
Dim cpt As Integer


For Each c In Range('b1:b' & Range('b65536').End(xlUp).Row)
       
If c.Interior.ColorIndex = 6 And c = 'a recontacter' Then
                cpt = cpt + 1
       
End If
Next c

MsgBox 'Il y a ' & cpt & ' personne(s) à recontacter.'
End Sub


salut
 
S

stefgand

Guest
Voilà à quoi j'arrive mais les compteurs ne marche pas, j'arrive toujours avec des compteurs à 1.
En fait j'aimerais que le compteur m'indique combien j'ai de refus, d'hors cible, etc ...



Sub Bouton1_QuandClic()
Dim c As Range
Dim cpt As Integer


For Each c In Range('b1:b' & Range('b65536').End(xlUp).Row)
If c.Interior.ColorIndex = 6 And c = 'A RAPPELER' Then
cpt = cpt + 1
End If
Next c
MsgBox 'Il y a ' & cpt & ' A RAPPELER.'


For Each c In Range('b1:b' & Range('b65536').End(xlUp).Row)
If c.Interior.ColorIndex = 6 And c = 'REFUS' Then
cpt = 1
End If
Next c
MsgBox 'Il y a ' & cpt & ' REFUS.'

For Each c In Range('b1:b' & Range('b65536').End(xlUp).Row)
If c.Interior.ColorIndex = 6 And c = 'OPPORTUNITE COMMERCIALE' Then
cpt = 1
End If
Next c
MsgBox 'Il y a ' & cpt & ' OPPORTUNITE COMMERCIALE.'

For Each c In Range('b1:b' & Range('b65536').End(xlUp).Row)
If c.Interior.ColorIndex = 6 And c = 'HORS CIBLE' Then
cpt = 1
End If
Next c
MsgBox 'Il y a ' & cpt & ' HORS CIBLE.'

For Each c In Range('b1:b' & Range('b65536').End(xlUp).Row)
If c.Interior.ColorIndex = 6 And c = 'ECHEC CONTACT' Then
cpt = 1
End If
Next c
MsgBox 'Il y a ' & cpt & ' ECHEC CONTACT.'

For Each c In Range('b1:b' & Range('b65536').End(xlUp).Row)
If c.Interior.ColorIndex = 6 And c = 'LJ/RJ' Then
cpt = 1
End If
Next c
MsgBox 'Il y a ' & cpt & ' LJ/RJ.'

End Sub
 

Hervé

XLDnaute Barbatruc
re stefgand

il te faut créer autant de compteur que tu as de variables :


Sub Bouton1_QuandClic()
Dim c As Range
Dim cptrappeler As Byte
Dim cptrefus As Byte
Dim cptopport As Byte
Dim cpthorscible As Byte
Dim cptechec As Byte
Dim cptljrj As Byte

For Each c In Range('b1:b' & Range('b65536').End(xlUp).Row)
       
If c.Interior.ColorIndex = 6 Then
               
Select Case c
                       
Case 'A RAPPELER': cptrappeler = cptrappeler + 1
                       
Case 'REFUS': cptrefus = cptrefus + 1
                       
Case 'OPPORTUNITE COMMERCIALE': cptopport = cptopport + 1
                       
Case 'HORS CIBLE': cpthorscible = cpthorscible + 1
                       
Case 'ECHEC CONTACT': cptechec = cptechec + 1
                       
Case 'LJ/RJ': cptljrj = cptljrj + 1
               
End Select
       
End If
Next c

MsgBox 'il y à :' & vbNewLine & vbNewLine & _
        cptrappeler & ' a rappeler' & vbNewLine & _
        cptrefus & ' refus' & vbNewLine & _
        cptopport & ' opportunité' & vbNewLine & _
        cpthorscible & ' hors cible' & vbNewLine & _
        cptechec & ' echec' & vbNewLine & _
        cptljrj & ' ljrj' & vbNewLine, , 'OUF...'
       
End Sub


salut
 

Discussions similaires

Réponses
7
Affichages
794
Réponses
2
Affichages
165

Statistiques des forums

Discussions
312 485
Messages
2 088 812
Membres
103 971
dernier inscrit
abdazee