Sub Mise_En_forme()
Dim Doublons As Object, Cell As Range, temp As String
'Dim Doublons As Dictionary
'Set Doublons = New Dictionary
Set Doublons = CreateObject("Scripting.Dictionary") 'on déclare l'objet Doublons
On Error Resume Next
With Feuil2.Range("A1:D" & Feuil2.Range("A" & Rows.Count).End(xlUp).Row)
.BorderAround xlContinuous, xlThin
End With
For Each Cell In Feuil2.Range("B2:B" & Feuil2.Range("B" & Rows.Count).End(xlUp).Row)
temp = Cell.Value & Cell.Offset(, 1).Value
If Not Doublons.exists(temp) Then 'si la valeur n'existe pas, on l'insère dans l'objet
Doublons.Add temp, temp
Cell.Offset(, -1).Resize(, 4).Borders(xlEdgeTop).LineStyle = xlContinuous
Else
With Cell.Offset(, -1).Resize(, 4)
.Borders(xlEdgeTop).LineStyle = xlNone
End With
End If
Next
Set Doublons = Nothing
On Error GoTo 0
End Sub