Identifying duplicate in a specific column but pasting entire row to new sheet

masawo

New Member
Joined
Jun 5, 2015
Messages
2
Afternoon all,

Hope someone can help me out or at least point me in the right direction. I'm looking to find a macro that will do the following: Scan Column N for duplicates (Columns are A - AA) once a duplicate is found, copy the entire row of said duplicate into new sheet, so new sheet would have Columns A-AA of only duplicates.

I've found a number of macros and also conditional formatting to identify dupes but not finding what my specific needs are or even close to that. Also looking for something that will be fairly quick, the data set is about 26K lines per month. Not sure if this matters or not, but for my needs i'm hiding a majority of the Columns that dont pertain to my needs but are important after my dup process is complete.

Thanks in advance for any help/pointers/tips you folks can provide.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hello,

Is this of any use?

Code:
Sub copy_DUPLICATES()
    Application.ScreenUpdating = False
    Range("AB2").Formula = "=COUNTIF($N$2:$N$" & Rows.Count & ",N2)"
    Range("AB2").Copy
    Range("AB3:AB" & Range("N" & Rows.Count).End(xlUp).Row).PasteSpecial (xlPasteAll)
    Range("AB1").Select
    Selection.AutoFilter Field:=28, Criteria1:=">1", Operator:=xlAnd
    Range("A2:AA" & Range("N" & Rows.Count).End(xlUp).Row).SpecialCells(xlCellTypeVisible).Copy
    Sheets("Sheet2").Range("A1").PasteSpecial (xlPasteValues)
    Selection.AutoFilter
    Columns("AB:AB").ClearContents
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Hello,

Is this of any use?

Code:
Sub copy_DUPLICATES()
    Application.ScreenUpdating = False
    Range("AB2").Formula = "=COUNTIF($N$2:$N$" & Rows.Count & ",N2)"
    Range("AB2").Copy
    Range("AB3:AB" & Range("N" & Rows.Count).End(xlUp).Row).PasteSpecial (xlPasteAll)
    Range("AB1").Select
    Selection.AutoFilter Field:=28, Criteria1:=">1", Operator:=xlAnd
    Range("A2:AA" & Range("N" & Rows.Count).End(xlUp).Row).SpecialCells(xlCellTypeVisible).Copy
    Sheets("Sheet2").Range("A1").PasteSpecial (xlPasteValues)
    Selection.AutoFilter
    Columns("AB:AB").ClearContents
    Application.ScreenUpdating = True
End Sub


You my friend are a godsend. This appears to be working exactly as i need it. Will keep playing with a few sheets but I'm very satisfied with what you offered. Thanks so much for your promptness and expert help!!

This board rocks!! :biggrin::biggrin::):)
 
Upvote 0

Forum statistics

Threads
1,203,453
Messages
6,055,533
Members
444,794
Latest member
HSAL

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