Forum Discussion
AStamenkov
Aug 26, 2022Copper Contributor
Clear duplicate content in xl column
I am trying to clear duplicate content in the cells in column B of my xl table. Remove Duplicates function is not suitable because it deletes rows. I only need to clear the duplicate content ...
HansVogelaar
Aug 26, 2022MVP
If you want to clear duplicate cells in column B:
Sub ClearDups()
Dim r As Long
Dim m As Long
Application.ScreenUpdating = False
m = Range("B" & Rows.Count).End(xlUp).Row
For r = 3 To m
If Application.CountIf(Range("B2:B" & r - 1), Range("B" & r).Value) Then
Range("B" & r).ClearContents
End If
Next r
Application.ScreenUpdating = True
End Sub