Bonjour,
J'ai réalisé le code suivant, et je ne comprends pas pourquoi quand je lance ma macro Excel me met "Erreur de compilation : Else sans If"...

D'où vient ce problème ? Merci par avance pour vos réponses !


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
For i = 3 To 39
For j = 2 To 19
 
If Cells(i, j).Value > 1200 Then Cells(i, j).Font.Color = RGB(90, 13, 38)
    ElseIf Cells(i, j).Value > 1100 Then Cells(i, j).Font.Color = RGB(112, 13, 38)
    ElseIf Cells(i, j).Value > 1000 Then Cells(i, j).Font.Color = RGB(176, 13, 38)
    ElseIf Cells(i, j).Value > 900 Then Cells(i, j).Font.Color = RGB(250, 13, 38)
    ElseIf Cells(i, j).Value > 800 Then Cells(i, j).Font.Color = RGB(250, 46, 38)
    ElseIf Cells(i, j).Value > 700 Then Cells(i, j).Font.Color = RGB(250, 96, 38)
    ElseIf Cells(i, j).Value > 600 Then Cells(i, j).Font.Color = RGB(250, 155, 38)
    ElseIf Cells(i, j).Value > 500 Then Cells(i, j).Font.Color = RGB(250, 252, 38)
    ElseIf Cells(i, j).Value > 400 Then Cells(i, j).Font.Color = RGB(250, 252, 109)
    ElseIf Cells(i, j).Value > 300 Then Cells(i, j).Font.Color = RGB(250, 252, 238)
    ElseIf Cells(i, j).Value > 200 Then Cells(i, j).Font.Color = RGB(13, 240, 190)
    ElseIf Cells(i, j).Value > 200 Then Cells(i, j).Font.Color = RGB(13, 117, 190)
    ElseIf Cells(i, j).Value > 100 Then Cells(i, j).Font.Color = RGB(13, 5, 190)
    ElseIf Cells(i, j).Value > 50 Then Cells(i, j).Font.Color = RGB(13, 5, 94)
    ElseIf Cells(i, j).Value > 15 Then Cells(i, j).Font.Color = RGB(13, 5, 4)
End If
 
Next j
Next i