View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Macro to Delete Duplicate Cells

Try:

Sub CleanA()
Dim n As Long
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = n To 2 Step -1
m = Application.WorksheetFunction.CountIf(Range("A1:A" & i), Range("A" &
i).Value)
If m 1 Then
Range("A" & i).Delete Shift:=xlUp
End If
Next
End Sub

--
Gary''s Student - gsnu201001


"MCRH" wrote:

Hi,

I've seen other questions regarding deleting duplicates but none of them
quite fit what I need.

I have values in column A. I want to delete the cell (shift up) of any and
all exact duplicates, but keep the original.

Thanks for your help!