Advance Filter UsedRange to new sheet Unique=True, The Unique part not working

capson

Board Regular
Joined
Jul 9, 2010
Messages
107
Hello,

My range goes from col A to col N, col A is the criteria for making unique it if filed with serial#

The "Sub CopyToNewMakeUnique()" filter copies but does not make unique, this is the first time I have tried this so maybe I do not understand what the unique is actually doing or I am not applying it properly.

I know I could filter copy then apply
Code:
Sub RemoveDupeHelper()


  Sheets(2).Select
  ' Remove duplicates, looking for unique values in columns A (Columns:=1).
  ActiveSheet.[A1].CurrentRegion.RemoveDuplicates Columns:=1, Header:=xlYes
 
  Range("A1").End(xlDown).Offset(1).Resize(ActiveSheet.UsedRange.Rows.Count).EntireRow.Delete
  
End Sub

But I was hoping to get the "Sub CopyToNewMakeUnique()" to copy only Unigue

Thanks

What I have
Code:
col A   col B       .    .    .     col N
456     Stuff1                      stuffn
456        .                            .
123        .                            .
123
789
159
456
159        .                             .

what I need
Code:
col A   col B  .   .   .  col N
456     stuff1            stuffn
123       .                   .
789       .                   .
159      stuffx           stuffr


Code:
Sub CopyToNewMakeUnique()
Dim lRow As Long



 Sheets(1).Select
    lRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row


    Sheets("Source").UsedRange.AdvancedFilter _
     Action:=xlFilterCopy, _
     CriteriaRange:=Sheets(1).Range("A1:A" & lRow), _
     CopyToRange:=Sheets(2).Range("A1"), _
     Unique:=True


End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Advanced Filter, Unique returns unique records across ALL the columns selected.
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,395
Members
449,446
Latest member
CodeCybear

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top