ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error filtering for unique values (https://www.excelbanter.com/excel-programming/415231-error-filtering-unique-values.html)

C. Corodan

Error filtering for unique values
 
I have the following code:

Range("D10").Select
Range("D10:D9999").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range( _
"D11111"), Unique:=True

The list of unique values always has a duplicate item at the beginning, fo
rexample:

A-Customer
A-Customer
B-Customer
C-Customer
D-Customer
Not assigned

Any idea what is the error?

Per Jessen

Error filtering for unique values
 
Hi

The filter function see the first cell as a heading.

Expand your range to : D9:D999. Just notice that it will copy the filtered
range including the heading to the desired place.

Hopes it helps.

Best regards,
Per

"C. Corodan" skrev i meddelelsen
...
I have the following code:

Range("D10").Select
Range("D10:D9999").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range( _
"D11111"), Unique:=True

The list of unique values always has a duplicate item at the beginning, fo
rexample:

A-Customer
A-Customer
B-Customer
C-Customer
D-Customer
Not assigned

Any idea what is the error?



C. Corodan

Error filtering for unique values
 
Thanks, you are right!

"Per Jessen" wrote:

Hi

The filter function see the first cell as a heading.

Expand your range to : D9:D999. Just notice that it will copy the filtered
range including the heading to the desired place.

Hopes it helps.

Best regards,
Per

"C. Corodan" skrev i meddelelsen
...
I have the following code:

Range("D10").Select
Range("D10:D9999").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range( _
"D11111"), Unique:=True

The list of unique values always has a duplicate item at the beginning, fo
rexample:

A-Customer
A-Customer
B-Customer
C-Customer
D-Customer
Not assigned

Any idea what is the error?





All times are GMT +1. The time now is 12:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com