Voor de formule kun je dit gebruiken:
=ALS(AANTAL.ALS(A:A; A1)>1;"Dubbel";"")
zet dit in cel B1 en doorvoeren naar beneden.
Macro gevonden voor kolom A :
Sub DeleteRows()
Dim i As Integer, j As Integer
Dim AantalRijen
Dim EersteInhoud As Variant, VolgendeInhoud As Variant
AantalRijen = Worksheets(1).UsedRange.Rows.Count
For i = 1 To AantalRijen - 1
EersteInhoud = Worksheets(1).Cells(i, 1)
If EersteInhoud <> "" Then
For j = i + 1 To AantalRijen
VolgendeInhoud = Worksheets(1).Cells(j, 1)
If VolgendeInhoud = EersteInhoud Then
Worksheets(1).Cells(j, 1).Interior.ColorIndex = 4
Worksheets(1).Cells(i, 1).Interior.ColorIndex = 4
End If
Next
End If
Next
End Sub
Public Sub DeleteDuplicateRows()
'
' This macro deletes duplicate rows in the selection. Duplicates are
' counted in the COLUMN of the active cell.
Dim Col As Integer
Dim r As Long
Dim C As Range
Dim N As Long
Dim V As Variant
Dim Rng As Range
On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Col = ActiveCell.Column
If Selection.Rows.Count > 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
N = 0
For r = Rng.Rows.Count To 1 Step -1
V = Rng.Cells(r, 1).Value
If Application.WorksheetFunction.CountIf(Rng.Columns(1), V) > 1 Then
Rng.Rows(r).EntireRow.Delete
N = N + 1
End If
Next r
EndMacro:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Pierre