Appliquer macro a plusieurs cellules

  • Initiateur de la discussion Initiateur de la discussion jo1177
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

jo1177

XLDnaute Junior
Bonjour le forum ! =)
Après avoir crée une macro me permettant d'avoir plus de 3 MeFC (problème majeur sur Excel 2003), je n'arrive pas a appliquer cette macro a toute une colonne, ou à une plage bien défini. Je n'arrive pas a résoudre ce problème, et je m'en reporte a vous ! Ci-joint, mon fichier excel avec d'amples explications et la macro qui va avec =)
Merci ! =)
Jonathan
 

Pièces jointes

Re : Appliquer macro a plusieurs cellules

Bonjour Jo bonjour le forum,

peut-être comme ça :
Code:
Private Sub Worksheet_Calculate()
[COLOR=red]Dim cel As Range[/COLOR]
[COLOR=red]For Each cel In Range("F2:F6")[/COLOR]
   If cel.Value < 0.4 Then
      cel.Interior.ColorIndex = 3
      cel.Interior.Pattern = xlSolid
   End If
    If [(MAX($C3:$E3)>$A2)*($F2<0.4)] Then
     cel.Interior.ColorIndex = 3
     cel.Interior.Pattern = xlUp
     cel.Interior.PatternColorIndex = xlAutomatic
   End If
   If cel.Value > 0.4 And cel.Value < 0.8 Then
      cel.Interior.ColorIndex = 8
      cel.Interior.Pattern = xlSolid
      cel.Interior.PatternColorIndex = xlAutomatic
   End If
   If [=(MAX($C3:$E3)>$A2)*($F2>0.4)] Then
      cel.Interior.ColorIndex = 8
      cel.Interior.Pattern = xlUp
      cel.Interior.PatternColorIndex = xlAutomatic
   End If
   If cel.Value > 0.8 Then
      cel.Interior.ColorIndex = 4
      cel.Interior.Pattern = xlSolid
   End If
   If [(MAX($C3:$E3)>$A2)*($F2>0.8)] Then
     cel.Interior.ColorIndex = 4
     cel.Interior.Pattern = xlUp
     cel.Interior.PatternColorIndex = xlAutomatic
   End If
[COLOR=red]Next cel[/COLOR]
End Sub
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Retour