![]() |
Find Duplicates Variant
Contrary to most people, I want to keep the duplicates in my spreadsheet!
What I need to do is basically keep anything that occurs 3 or more times. I have had a go at amending the code posted up so far but am not having a huge amount of luck - would anyone be kind enough to help? Many thanks! |
Find Duplicates Variant
Public Sub ProcessData()
Dim iLastRow As Long Dim i As Long With ActiveSheet iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = iLastRow To 1 Step -1 If Application.CountIf(Range("A1:A" & iLastRow), .Cells(i, "A").Value) < 3 Then .Rows(i).Delete End If Next i End With End Sub -- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "Ladymuck" wrote in message ... Contrary to most people, I want to keep the duplicates in my spreadsheet! What I need to do is basically keep anything that occurs 3 or more times. I have had a go at amending the code posted up so far but am not having a huge amount of luck - would anyone be kind enough to help? Many thanks! |
Find Duplicates Variant
Thanks Bob for such a quick reply, I'll try that out
"Bob Phillips" wrote: Public Sub ProcessData() Dim iLastRow As Long Dim i As Long With ActiveSheet iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = iLastRow To 1 Step -1 If Application.CountIf(Range("A1:A" & iLastRow), .Cells(i, "A").Value) < 3 Then .Rows(i).Delete End If Next i End With End Sub -- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "Ladymuck" wrote in message ... Contrary to most people, I want to keep the duplicates in my spreadsheet! What I need to do is basically keep anything that occurs 3 or more times. I have had a go at amending the code posted up so far but am not having a huge amount of luck - would anyone be kind enough to help? Many thanks! |
All times are GMT +1. The time now is 09:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com