From: MCRH on
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!
From: Gary''s Student on
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!
From: MCRH on
Works perfectly! This is exactly what I needed. Thank you so much!

"Gary''s Student" wrote:

> 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!
 | 
Pages: 1
Prev: prioritized assembly data
Next: Data Entry Form