Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

Problème compréhension VBA

jo1177

XLDnaute Junior
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
 

Pièces jointes

  • MFCPlus3Expression2.zip
    15.6 KB · Affichages: 17
Dernière édition:

Discussions similaires

Réponses
4
Affichages
246
Réponses
4
Affichages
355
Réponses
3
Affichages
143
Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…