logandiana
Board Regular
- Joined
- Feb 21, 2017
- Messages
- 107
I have looked and tried several ways to identify duplicates and copy them to a new sheet.
I have about 20,000 lines in columns A:J. If there are duplicates in column E, then I want move the entire row (both original and duplicate) to the new sheet.
I've used VBA to add a countif formula to column K, then turn it to values, autofilter on greater than 1, then copy and paste to the destination sheet.
This is the method I am currently using but it does slow the macro down almost by 45 seconds or so.
I've tried some other methods using conditional formatting to identify dups with a color, then using loops and IF THEN to check each cell, but this portion takes several minutes.
Any other ideas that could accomplish what I am wanting to do much faster?
I have about 20,000 lines in columns A:J. If there are duplicates in column E, then I want move the entire row (both original and duplicate) to the new sheet.
I've used VBA to add a countif formula to column K, then turn it to values, autofilter on greater than 1, then copy and paste to the destination sheet.
This is the method I am currently using but it does slow the macro down almost by 45 seconds or so.
Code:
With MM
.Range("K2:K" & LR1).FormulaR1C1 = "=COUNTIF(R2C5:R" & LR1 & "C5,RC[-6])"
.Range("K2:K" & LR1).Value = .Range("K2:K" & LR1).Value
.Range("A1:K" & LR1).AutoFilter , Field:=11, Criteria1:=">1"
.Range("A1:J" & LR1).Copy Destination:=DUPS.Range("A1")
End With
Any other ideas that could accomplish what I am wanting to do much faster?