Could you get away with highlighting your data and going to
Data - filter - advanced filter
Select copy to another place and check unique records only.
If no-one else resonds, check out Dave's Hawleys site (link on any of responses) He has a section devoted to dealing with duplicates.
good luck
Ian
Hi Thomas
As Ivan has suggested Excels Advanced filter is by far the quickest way to handle this. The code below will simply automate the task.
Sub DuplicatesGo()
'Written by OzGrid Business Applications
'www.ozgrid.com
''''''''''''''''''''''''''''''''''''''''''
'Extract unique entries only
''''''''''''''''''''''''''''''''''''''''''
Dim RUniqueCells As Range
With Sheet1
'Set Range variable to all entries
Set RUniqueCells = Range(.Range("A1"), .Range("A65536").End(xlUp))
'Advance filter to remove duplicates
RUniqueCells.AdvancedFilter _
Action:=xlFilterCopy, CopyToRange:=.Range("B1"), unique:=True
End With
'Release memory
Set RUniqueCells = Nothing
End Sub
Dave
OzGrid Business Applications
Dave, thanks for the help. This routine filters the criteria column correctly, but only copies that column. Is there a way to copy all the unique rows with one column as the criteria for uniqueness?
Thanks
Thomas, yes there is! This code will do so and place the results on a new sheet it creates.
Sub DuplicatesGo()
'Written by OzGrid Business Applications
'www.ozgrid.com
''''''''''''''''''''''''''''''''''''''''''
'Create a Worksheet
'Extract unique entries only
'Then copy the entire rows to
'the new sheet
''''''''''''''''''''''''''''''''''''''''''
Dim RUniqueCells As Range
'Add a new sheet and name it
'If already exists then rename it
On Error Resume Next
Sheets.Add().Name = "Unique Copies"
If ActiveSheet.Name <> "Unique Copies" Then
ActiveSheet.Name = "Unique Copies" & Sheets.Count
End If
On Error GoTo 0
With Sheet1
'Set Range variable to all entries
Set RUniqueCells = Range(.Range("A1"), .Range("A65536").End(xlUp))
'Advance filter to remove duplicates
RUniqueCells.AdvancedFilter _
Action:=xlFilterInPlace, unique:=True
.UsedRange.SpecialCells(xlCellTypeVisible).Copy _
Destination:=ActiveSheet.Range("A1")
.ShowAllData
End With
Application.CutCopyMode = False
'Release memory
Set RUniqueCells = Nothing
End Sub
OzGrid Business Applications