J'ai écrit le code ci dessous qui marche mais qui est trés long car je le duplique pour chaque cellule.
Pourriez vous m'aider à le simplifier. L'ideal serait de récupérer le nom d'une plage définie dans excel.
Un grand merci par avance
If Range('b138') > Range('C138') Then
Range('C138').Interior.ColorIndex = 10
Else: Range('C138').Interior.ColorIndex = 45
End If
If Range('b139') > Range('C139') Then
Range('C139').Interior.ColorIndex = 10
Else: Range('C139').Interior.ColorIndex = 45
End If
For each x in Range('B138:B150')
if x > x.Offset(0,1) then
x.Offset(0,1).select
selection.Interior.ColorIndex = 10
Elseif x < x.Offset(0,1) then
x.Offset(0,1).select
selection.Interior.ColorIndex = 45
End If
Next x
Dim bytCount As Byte For bytCount = 138 To 150 With Cells(bytCount, 3) If .Value < Cells(bytCount, 2) Then
.Interior.ColorIndex = 10 Else
.Interior.ColorIndex = 45 End If End With Next bytCount