simplifier mon code pour colorier des cellules

Walden

XLDnaute Nouveau
Bonjour à tous .

J'aimerais une petite aide pour faire une boucle du code que j'ai fais. Ca marche tres bien mais quand je dois changer c'est long. je joins le fichier, je vous remercie par avance.


Walden. [file name=code_20060317165000.zip size=5621]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/code_20060317165000.zip[/file]
 

Pièces jointes

  • code_20060317165000.zip
    5.5 KB · Affichages: 17

Bernard_XLD

XLDnaute Barbatruc
Membre du Staff
Bonjour Walden

essaie cela

A+
Code:
    Dim Cellule_en_Cours As Range
    For Each Cellule_en_Cours In Sheets('Synthèse').Range('E3:E8')
    With Cellule_en_Cours
        Select Case .Value
        Case Is < 0.2
            .Interior.ColorIndex = 3
        Case Is < 0.4
            .Interior.ColorIndex = 45
        Case Is < 0.6
            .Interior.ColorIndex = 6
        Case Is < 0.8
            .Interior.ColorIndex = 4
        Case Is <= 1
            .Interior.ColorIndex = 10
        Case Else
        End Select
    End With
    Next Cellule_en_Cours

Message édité par: yeahou, à: 17/03/2006 17:03
 

justine

XLDnaute Occasionnel
bonsoir le forum, walden
for i = 3 to 8
If Sheets('Synthèse').Range('E'&i).Value = 0.2 And Sheets('Synthèse').Range('E'&i).Value = 0.4 And Sheets('Synthèse').Range('E'&i).Value = 0.6 And Sheets('Synthèse').Range('E'&i).Value = 0.8 And Sheets('Synthèse').Range('E'&i).Value <= 1 Then Sheets('Synthèse').Range('E'&i).Interior.ColorIndex = 10
next
 

JC de Lorient

XLDnaute Impliqué
salut

a essayer (moi je l'ai pas fait !!)
Sub couleur()
Dim x As Byte
With Sheets('Synthèse')
For x = 3 To 8
If Range('E' & x) = 0.2 And Range('E' & x).Value = 0.4 And Range('E' & x).Value = 0.6 And Range('E' & x).Value = 0.8 And Range('E' & x).Value <= 1 Then Range('E3').Interior.ColorIndex = 10
Next x
End With
End Sub


JC
 

JC de Lorient

XLDnaute Impliqué
re

oh là c koi ce binz ?????

Sub couleur()
Dim x As Byte
With Sheets('Synthèse')
For x = 3 To 8
If Range('E' & x) = 0.2 And Range('E' & x).Value = 0.4 And Range('E' & x).Value = 0.6 And Range('E' & x).Value = 0.8 And Range('E' & x).Value <= 1 Then Range('E3').Interior.ColorIndex = 10
Next x
End With
End Sub

jc
 

Discussions similaires

Réponses
19
Affichages
2 K

Statistiques des forums

Discussions
312 687
Messages
2 090 950
Membres
104 705
dernier inscrit
Mike72