olibelle0101
XLDnaute Occasionnel
Bonsoir le forum.
Je me trouve avec un petit soucis de code.
Voici ce code :
Sub colorise()
Worksheets("selections").Activate
For ligne = 3 To 369
Set r1 = Range(Cells(ligne, 9), Cells(ligne, 19))
r1.Select
For Each c In r1
If c.Value = Cells(ligne, 21).Value Then
c.Font.Bold = True
With c.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
End If
Next c
For Each c In r1
If c.Value = Cells(ligne, 22).Value Then
c.Font.Bold = True
With c.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
End If
Next c
For Each c In r1
If c.Value = Cells(ligne, 23).Value Then
c.Font.Bold = True
With c.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
End If
Next c
For Each c In r1
If c.Value = Cells(ligne, 24).Value Then
c.Font.Italic = True
c.Font.Bold = True
With c.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
End If
Next c
For Each c In r1
If c.Value = Cells(ligne, 25).Value Then
c.Font.Italic = True
With c.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
End If
Next c
Next ligne
End Sub
Il me met une couleur suivant des valeur identique (c'est parfait)
Mais si il y a aucune valeur dans "ligne 21 22 ou 23 etc..."
Je ne veut pas qu'il me met de couleur dans "Set r1 = Range(Cells(ligne, 9), Cells(ligne, 19))"
si dans celle-ci il y a aussi aucune valeur dans certaines cellules.
Merci pour vos conseil.
A bientôt.
Je me trouve avec un petit soucis de code.
Voici ce code :
Sub colorise()
Worksheets("selections").Activate
For ligne = 3 To 369
Set r1 = Range(Cells(ligne, 9), Cells(ligne, 19))
r1.Select
For Each c In r1
If c.Value = Cells(ligne, 21).Value Then
c.Font.Bold = True
With c.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
End If
Next c
For Each c In r1
If c.Value = Cells(ligne, 22).Value Then
c.Font.Bold = True
With c.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
End If
Next c
For Each c In r1
If c.Value = Cells(ligne, 23).Value Then
c.Font.Bold = True
With c.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
End If
Next c
For Each c In r1
If c.Value = Cells(ligne, 24).Value Then
c.Font.Italic = True
c.Font.Bold = True
With c.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
End If
Next c
For Each c In r1
If c.Value = Cells(ligne, 25).Value Then
c.Font.Italic = True
With c.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
End If
Next c
Next ligne
End Sub
Il me met une couleur suivant des valeur identique (c'est parfait)
Mais si il y a aucune valeur dans "ligne 21 22 ou 23 etc..."
Je ne veut pas qu'il me met de couleur dans "Set r1 = Range(Cells(ligne, 9), Cells(ligne, 19))"
si dans celle-ci il y a aussi aucune valeur dans certaines cellules.
Merci pour vos conseil.
A bientôt.
Dernière édition: