Private Sub CommandButton1_Click()
Dim i As Long
Dim j As Long
Dim lastRow As Long
Dim doublons As String
Application.ScreenUpdating = False
lastRow = ActiveSheet.Range("B" & Rows.Count).End(xlUp).Row
For i = 5 To lastRow
For j = i + 1 To lastRow
If UCase(Cells(i, 2).Value) = UCase(Cells(j, 2).Value) Then
doublons = doublons & "Ligne " & i & " et ligne " & j & vbCrLf
End If
Next j
Next i
If Len(doublons) > 0 Then
MsgBox "Les lignes suivantes contiennent des doublons :" & vbCrLf & doublons
Else
MsgBox "Aucun doublon trouvé."
End If
Application.ScreenUpdating = True
End Sub