View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
burl_rfc burl_rfc is offline
external usenet poster
 
Posts: 24
Default Eliminating duplicate records using advanced filter even with unique set to true

The code below is supposed to select all the none duplicate records
from a given range, but for some strange reason I do get duplicates but
only when the first cell in the range is identical to the second cell
in the range, if the first and second cells within the range are not
identical then I get all none duplicates in the output.

How can I prevent the output from containing duplicate records?

I did think of pre-sorting the range so that non-duplicate records were
in the first and second cells, but I can never guarentee that
non-duplicates would be in the range.

Dim aRange As Object

Set aRange = ActiveSheet.Range _
(Selection, Selection.End(xlDown))
aRange.AdvancedFilter Action:=xlFilterCopy, CopyToRange:= _
Range("G3"), Unique:=True

burl