Sub compareCompteOk()
Dim plage1 As Range, Plage2 As Range, c1 As Range, c2 As Range
With Sheets("Feuil1")
Set plage1 = .Range("A" & .Rows.Count).End(xlUp)
If plage1.Row > 1 Then Set plage1 = .Range("A2", plage1) Else Set plage1 = Nothing
End With
With Sheets("Feuil2")
Set Plage2 = .Range("A" & .Rows.Count).End(xlUp)
If Plage2.Row > 1 Then Set Plage2 = .Range("A2", Plage2) Else Set Plage2 = Nothing
End With
If plage1 Is Nothing Or Plage2 Is Nothing Then Exit Sub
For Each c1 In plage1.Cells
Set c2 = Plage2.Find(What:=c1, LookIn:=xlValues, LookAt:=xlWhole)
'Si le numéro est trouvé dans feuille2
If Not c2 Is Nothing Then
'Si le compte est vide en feuil1
If IsEmpty(c1(1, 2)) Then
'Si le compte est vide en feuil1
c1.Interior.ColorIndex = xlColorIndexAutomatic
c2.Interior.ColorIndex = xlColorIndexAutomatic
Else
'Si le compte en feuil2 est ok
If UCase(c2.Offset(, 1)) = "OK" Then 'Si Ok
'couleur jaune
c2.Interior.ColorIndex = 6
c1.Interior.ColorIndex = 6
Else 'sinon
'Couleur Rouge
c2.Interior.ColorIndex = 3
c1.Interior.ColorIndex = 3
End If
End If
Else
'Si le numéro n'est pas dans feuil2
c1.Interior.ColorIndex = xlColorIndexAutomatic
End If
Next c1
End Sub