View Single Post
  #2   Report Post  
JMB
 
Posts: n/a
Default How to get rid off duplicate items?

Save your work before trying. This will delete the entire row of duplicate
items.
Select the range you want evaluated and run.

Sub DeleteDuplicates()
Dim Isect As Range
Dim x As Range
Dim RangeToDelete
Dim NoDupes As New Collection

On Error Resume Next
Set Isect = Application.Intersect(Selection, _
ActiveSheet.UsedRange)

For Each x In Isect
NoDupes.Add x.Value, CStr(x.Value)
If Err.Number < 0 Then
Err.Clear
If IsEmpty(RangeToDelete) Then
Set RangeToDelete = x
Else: Set RangeToDelete = Union(RangeToDelete, x)
End If
End If
Next x

If Not IsEmpty(RangeToDelete) Then _
RangeToDelete.EntireRow.Delete

End Sub

"Svea" wrote:


Hello!

I attached a xls file showing start and end of the project.

As you can see in END sheet there is no duplicate values in first
column.
Can I do it without help of pivot (or manually deleting every duplicate
:) )?

Thanks a lot!


+-------------------------------------------------------------------+
|Filename: EXAMPLE.zip |
|Download: http://www.excelforum.com/attachment.php?postid=3911 |
+-------------------------------------------------------------------+

--
Svea
------------------------------------------------------------------------
Svea's Profile: http://www.excelforum.com/member.php...o&userid=28151
View this thread: http://www.excelforum.com/showthread...hreadid=476659