Remove duplicates in macro working in one instance not in another

thewoodington

Board Regular
Joined
Dec 29, 2011
Messages
100
Hi guys,

I am trying to remove the duplicates from column A, then select the contents on column Y paste that into another sheet. Here I remove duplicates again.

My code will not remove duplicates on the first instance but doesn't remove duplicates on the second instance. I can see the code is different but cannot see why one works and other one doesn't?

Code:
Sheets("Accepted Apps").Select
    ActiveSheet.Range("$A$1:$AH$1000000").RemoveDuplicates Columns:=1, Header:= _
        xlYes
   
    Columns("Y:Y").Select
    Selection.Copy
        Sheets("Trends").Select
        
            Range("A1").Activate
    ActiveSheet.Paste
    
    Application.CutCopyMode = False
    ActiveSheet.Range("A:A").RemoveDuplicates Columns:=1, Header:=xlNo

Can someone please help?

Thanks
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
If you first duplicate remove oes not work then might you have blank column in last. try this
Code:
Sheets("Accepted Apps").Range("$A$1:$AH$1000000").RemoveDuplicates Columns:=1, Header:=xlYes
   
Sheets("Accepted Apps").Columns("Y:Y").Copy
       
Sheets("Trends").Range("A1").PasteSpecial xlPasteValues
    
Application.CutCopyMode = False
Sheets("Trends").Range("A:A").RemoveDuplicates Columns:=1, Header:=xlNo
 
Upvote 0

Forum statistics

Threads
1,211,881
Messages
6,104,552
Members
447,915
Latest member
jpearson

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