surligné ligne condition

Arnaud5962

XLDnaute Junior
bonjour, voici ma macro mais je voudrais qu'en plus de cela, elle me surligne en jaune, les ligne dont la valeur de la colonne en H est négative.
Merci d'avance

Sub jaune()
Dim c As Range
Application.FindFormat.Clear
With Worksheets(1).Range("a1:j500")
Set c = .Find("Remboursement", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
With c.EntireRow.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If

Set c = .Find("Annulé", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
With c.EntireRow.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
Set c = .Find("Paiement reçu", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
With c.EntireRow.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If


End With
End Sub
 

Robert

XLDnaute Barbatruc
Repose en paix
Re : surligné ligne condition

Bonjour Arnaud, bonjour le forum,

Déclare la variable x en début de macro :
Code:
Dim x As Integer
et rajoute ce bout de code avant le End Sub :
Code:
For x = 1 To 500
    If Worksheets(1).Cells(x, 8).Value < 0 Then Worksheets(1).Rows(x).Interior.ColorIndex = 6
Next x
 

Statistiques des forums

Discussions
312 962
Messages
2 093 996
Membres
105 906
dernier inscrit
Evolugame