Sub Macro_Doublon()
Dim NbDoublon As Integer
Dim Doublon As Boolean
Dim Fin As Boolean
Dim CouleurR As Integer
Dim CouleurV As Integer
Dim CouleurB As Integer
Dim CouleurInc As Integer
Macro_Réinit_Doublon
With ActiveSheet
NbDoublon = 0
For Each cell In .Range("TABLEAU2")
Doublon = False
If Not (IsEmpty(cell)) Then
Fin = False
For Each cell2 In .Range("TABLEAU2")
If (cell2.Value = cell.Value) And (cell.Address <> cell2.Address) And (Not Fin) Then
If (cell.Row < cell2.Row) Or ((cell.Row = cell2.Row) And (cell.Column < cell2.Column)) Then
If Not Doublon Then
Doublon = True
CouleurInc = Application.Min(255, NbDoublon * 20)
CouleurR = 255 - CouleurInc
CouleurV = CouleurInc
CouleurB = CouleurInc
NbDoublon = NbDoublon + 1
End If
With cell.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = RGB(CouleurR, CouleurV, CouleurB)
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With cell2.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = RGB(CouleurR, CouleurV, CouleurB)
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Else
Fin = True
End If
End If
Next
End If
Next
End With
End Sub
Sub Macro_Réinit_Doublon()
With ActiveSheet
For Each cell In .Range("TABLEAU2")
With cell.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Next
End With
End Sub