I scoured the web yesterday looking for ways to search for duplicate entries on a sheet. There are dozens of approaches out there, but every one I found is based on searching for all duplicates at once and in some way pointing them out on the sheet. Honestly, I thought Excel already has a built-in function for doing this....
In any case, I'm looking for something different. I'm attaching a screenshot of a rough mock-up of what I'm aiming for. Basically I'd like a userform that would (a) locate the first pair of duplicates in one column—C, in this sample; (b) display the corresponding data in other columns (A and B, here), so I can see whether the duplication is valid; and then (c) when clicked again, move on to the next pair. Here's a typical example of the code I found out there, which I was trying to adapt to this purpose. But I can't figure out how you would interrupt the process at the first duplication, and then start it again for the next, and so on.
Code: Select all
Sub FindDups()
Dim lastRow As Long
Dim matchFoundIndex As Long
Dim iCntr As Long
lastRow = Range("C65000").End(xlUp).Row
For iCntr = 1 To lastRow
If Cells(iCntr, 1) <> "" Then
matchFoundIndex = WorksheetFunction.Match(Cells(iCntr, 3), Range("C1:C" & lastRow), 0)
If iCntr <> matchFoundIndex Then
Cells(iCntr, 4) = "Duplicate"
End If
End If
Next
End Sub