Bonjour le forum !
Voilà, j'ai un petit problème de compréhension d'une ligne de VBA.
Voici la macro :
Private Sub Worksheet_Calculate()
For lig = 2 To 4 Step 2
Set c = Cells(lig, 6)
If c.Value < 0.4 Then
c.Interior.ColorIndex = 3
c.Interior.Pattern = xlSolid
End If
'If [(MAX($C3:$E3)>$A2)*($F2<0.4)] Then
If Application.Max(c.Offset(, -3).Resize(1, 3).Offset(1)) > c.Offset(, -5).Value And c.Value < 0.4 Then
c.Interior.ColorIndex = 3
c.Interior.Pattern = xlUp
c.Interior.PatternColorIndex = xlAutomatic
End If
If c.Value > 0.4 And c.Value < 0.8 Then
c.Interior.ColorIndex = 8
c.Interior.Pattern = xlSolid
c.Interior.PatternColorIndex = xlAutomatic
End If
'If [=(MAX($C3:$E3)>$A2)*($F2>0.4)] Then
If Application.Max(c.Offset(, -3).Resize(1, 3).Offset(1)) > c.Offset(0, -5).Value And c.Value > 0.4 Then
c.Interior.ColorIndex = 8
c.Interior.Pattern = xlUp
c.Interior.PatternColorIndex = xlAutomatic
End If
If c.Value > 0.8 Then
c.Interior.ColorIndex = 4
c.Interior.Pattern = xlSolid
End If
'If [(MAX($C3:$E3)>$A2)*($F2>0.8)] Then
If Application.Max(c.Offset(, -3).Resize(1, 3).Offset(1)) > c.Offset(0, -5).Value And c.Value > 0.8 Then
c.Interior.ColorIndex = 4
c.Interior.Pattern = xlUp
c.Interior.PatternColorIndex = xlAutomatic
End If
Next lig
End Sub
Je ne comprend pas cette ligne :
If Application.Max(c.Offset(, -3).Resize(1, 3).Offset(1)) > c.Offset(0, -5).Value And c.Value > 0.8 Then
Je ne comprend pas le raisonnement. Pouvez vous m'expliquer plus en détail, sachant que je connais rien au VBA?! lol Je vous joint le fichier excel qui va avec pour plus de compréhension.
Merci !
Jonathan