Hi Guys.
I'm with a sheet and I need a way to remove BOTH duplicates. Meaning if 2 rows are identical I want both of them to be deleted, not just one. Say I want to do this for columns A:E, and I do have headers.
Is there a way I can do this? Thanks for your help ahead of time.
mayhem12,
Something like this?
Sub tgr() With ActiveSheet.UsedRange With Cells(.Row, .Column + .Columns.Count).Resize(.Rows.Count) .Formula = "=ConcatRng(" & Range(Cells(.Row, ActiveSheet.UsedRange.Column), Cells(.Row, .Column - 1)).Address(0, 0) & ")" .Offset(0, 1).Formula = "=if(countif(" & .Address & "," & Cells(.Row, .Column).Address(0, 0) & ")>1,1,0)" .Offset(0, 1).AutoFilter 1, 1 .Offset(1).EntireRow.Delete .Offset(0, 1).AutoFilter .Resize(, 2).EntireColumn.Delete End With End With End Sub Public Function ConcatRng(Rng As Range) As String Dim c As Range For Each c In Rng ConcatRng = ConcatRng & c.Value Next c End Function
Hope that helps,
~tigeravatar
Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks