Workbook change + mfc

GADENSEB

XLDnaute Impliqué
Bonjour le Forum,

Si le fichier joint j'aimerais faire un workbook_change avec une mfc sur la colonne B quand il est inscrit "A TRAITER"


mais ya un bug.. problème de propriété ....
il me manque un "C.proprete....." je crois



Code:
Private Sub Worksheet_Change(ByVal Target As Range)
      Dim fin&, c As Range
      
    With Sheets("BASE EMPLOI")
    fin = .Range("A" & Rows.Count).End(3).Row
    For Each c In .Range("B2:B" & fin)
    
         .Add Type:=xlTextString, String:="A TRAITER", _
        TextOperator:=xlContains
       .FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
        .FormatConditions(1).Interior
        .Pattern = xlPatternLinearGradient
        .Gradient.Degree = 90
        .Gradient.ColorStops.Clear
        .FormatConditions(1).Interior.Gradient.ColorStops.Add (0)
        .ThemeColor = xlThemeColorDark1
        .TintAndShade = 0
       .FormatConditions(1).Interior.Gradient.ColorStops.Add (1)
        .ThemeColor = xlThemeColorAccent1
        .TintAndShade = 0
          .FormatConditions(1).StopIfTrue = False
         
  Next c
End With
 
        
End Sub

qqn aurait une idée ?
 

Pièces jointes

  • MFC.xlsm
    20 KB · Affichages: 23
  • MFC.xlsm
    20 KB · Affichages: 20
Dernière édition:

GADENSEB

XLDnaute Impliqué
Re : Workbook change + mfc

Hello
j'ai trouvé

J'ai un peu triché mais ca marche nikel

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim fin&, c As Range
      
With Sheets("BASE EMPLOI")
    fin = .Range("A" & Rows.Count).End(3).Row
    
For Each c In .Range("B2:B" & fin)

    If c = "A TRAITER" Then
        c.Interior.ColorIndex = 17
    Else
        c.Interior.ColorIndex = 0
    End If
         
Next c
End With
         
End Sub

Bonne journée

seb
 

Statistiques des forums

Discussions
312 303
Messages
2 087 047
Membres
103 441
dernier inscrit
MarioC