ups jeg refererede til det forkerte spørgsmål
www.eksperten.dk/spm/56118Det går fint med at markere dubletter med fed skrift. Men denne kan jeg ikke få til at virke
Sub SletDubletter()
Dim iX As Integer
Dim iRow As Integer
Dim rCell As Range
For Each rCell In Range(\"B1:B20\")
If rCell = \"\" And rCell.Offset(1, 0) = \"\" And rCell.Offset(2, 0) = \"\" Then
iRow = rCell.Row
Exit For
End If
Next rCell
For iX = iRow To 2 Step -1
If Range(\"B\" & iX).Font.Bold = True Then Range(\"B\" & iX).EntireRow.Delete
Next iX
End Sub
og denne går ned når der er mange poster:
Sub FjernDublettal()
Dim dubletter As Range
Dim celle1 As Range
Dim Celle2 As Range
For Each celle1 In Selection
For Each Celle2 In Selection
If celle1 = Celle2 Then
If celle1.Address <> Celle2.Address Then
If dubletter Is Nothing Then
Set dubletter = Union(celle1, Celle2)
Else
Set dubletter = Union(dubletter, celle1, Celle2)
End If
End If
End If
Next Celle2
Next celle1
dubletter.Clear
Selection.Sort ActiveCell, xlAscending
\'Eller:
\'dubletter.Delete (xlShiftUp)
End Sub
hook