Problème avec le reste d'une division
Bonjour avec le code suivant je voudrais qu'une ligne sur deux se colorie de manière différente avec un certain encadré.
J'ai donc fait le code suivant mais je ne comprends pas pourquoi mes lignes se colorent de la même couleur...
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| For i = 1 To Range("F1").Value
Range("B" & 2 + i) = "Fournisseurs"
Range(Range("B" & i + 2), Range("C" & i + 2)).Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
If i + 2 Mod 2 = 0 Then
Range(Range("B" & i + 2), Range("C" & i + 2)).Select
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
Else
Range(Range("B" & i + 2), Range("C" & i + 2)).Select
With Selection.Interior
.ColorIndex = 37
.Pattern = xlSolid
End With
End If
Range("C" & i + 2).Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Next i |
je vous ai mis en rouge la partie qui je pense pose problème mais je ne vois vraiment pas ce qu'il y a.
Merci pour votre aide