Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Filter/Copy Unique records

I have this simple code.
Range("H:H").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("O1"),
Unique:=True
Im trying to get a list of the Unique reords in column H.
For some reason if row H1 and H2 are the same I end up with 2 records the
same.
Example:
H1 = 249653634
H2 = 249653634
H3 = 445434212
H4 = 551569206
H5 = 551569206
H6 = 551569206
H7 = 249721825
H8 = 445531266
H9 = 249877803
H10 = 351145588
H11 = 351145588
I end up with a list that is not Unique as listed below
249653634
249653634
445434212
551569206
249721825
445531266
249877803
351145588
If H1 and H2 are different then everythig is good.
Am I missing something?
  #2   Report Post  
Posted to microsoft.public.excel.programming
~L ~L is offline
external usenet poster
 
Posts: 177
Default Filter/Copy Unique records

The function assumes you have headers. Insert a real header or adjust your
range down one row.

"Mike" wrote:

I have this simple code.
Range("H:H").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("O1"),
Unique:=True
Im trying to get a list of the Unique reords in column H.
For some reason if row H1 and H2 are the same I end up with 2 records the
same.
Example:
H1 = 249653634
H2 = 249653634
H3 = 445434212
H4 = 551569206
H5 = 551569206
H6 = 551569206
H7 = 249721825
H8 = 445531266
H9 = 249877803
H10 = 351145588
H11 = 351145588
I end up with a list that is not Unique as listed below
249653634
249653634
445434212
551569206
249721825
445531266
249877803
351145588
If H1 and H2 are different then everythig is good.
Am I missing something?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Filter/Copy Unique records

This is the real code here
ws.Range(CustomerPONumber & 1 & ":" & CustomerPONumber &
lastrow).AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=ws.Range(UniqueRecords & 1), Unique:=True

"~L" wrote:

The function assumes you have headers. Insert a real header or adjust your
range down one row.

"Mike" wrote:

I have this simple code.
Range("H:H").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("O1"),
Unique:=True
Im trying to get a list of the Unique reords in column H.
For some reason if row H1 and H2 are the same I end up with 2 records the
same.
Example:
H1 = 249653634
H2 = 249653634
H3 = 445434212
H4 = 551569206
H5 = 551569206
H6 = 551569206
H7 = 249721825
H8 = 445531266
H9 = 249877803
H10 = 351145588
H11 = 351145588
I end up with a list that is not Unique as listed below
249653634
249653634
445434212
551569206
249721825
445531266
249877803
351145588
If H1 and H2 are different then everythig is good.
Am I missing something?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Filter/Copy Unique records


Untested -

With ws.Range(CustomerPONumber & 1 & ":" & CustomerPONumber & lastrow)
.Rows(1).Insert Shift:=xlDown ' assumes bottom row is empty
.Rows(1) = "dummy"
.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=ws.Range(UniqueRecords & 1), Unique:=True
.Rows(1).Delete Shift:=xlUp
End With
ws.Range(UniqueRecords & 1).Delete Shift:=xlUp

Inserts header(s) in the filter range, filter, delete shift up both top row
of filter-range and copy-to-range

Regards,
Peter T

"Mike" wrote in message
...
This is the real code here
ws.Range(CustomerPONumber & 1 & ":" & CustomerPONumber &
lastrow).AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=ws.Range(UniqueRecords & 1), Unique:=True

"~L" wrote:

The function assumes you have headers. Insert a real header or adjust
your
range down one row.

"Mike" wrote:

I have this simple code.
Range("H:H").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range("O1"),
Unique:=True
Im trying to get a list of the Unique reords in column H.
For some reason if row H1 and H2 are the same I end up with 2 records
the
same.
Example:
H1 = 249653634
H2 = 249653634
H3 = 445434212
H4 = 551569206
H5 = 551569206
H6 = 551569206
H7 = 249721825
H8 = 445531266
H9 = 249877803
H10 = 351145588
H11 = 351145588
I end up with a list that is not Unique as listed below
249653634
249653634
445434212
551569206
249721825
445531266
249877803
351145588
If H1 and H2 are different then everythig is good.
Am I missing something?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic filter for unique records jc132568 Excel Worksheet Functions 11 October 23rd 09 06:41 AM
unique records by advanced filter Stefi Excel Discussion (Misc queries) 10 October 5th 09 08:04 AM
Filter out unique records from pivot Hile Excel Worksheet Functions 1 April 17th 07 10:16 PM
Filter Unique Records Dee Excel Discussion (Misc queries) 1 June 23rd 06 09:22 PM
unique filter results in some non-unique records. Serials Librarian Excel Discussion (Misc queries) 2 May 26th 06 09:58 PM


All times are GMT +1. The time now is 09:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"