fredrerik84
Active Member
- Joined
- Feb 26, 2017
- Messages
- 383
Hi guys Ive used all the stuff ive learned over the last 6 months to create this code which basically search for duplicates.
I was hoping someone could help me finish it as I'm stuck and don't know what to do. This code returns values if I have duplicates matches. as you can see I have it to return data from column N. I would somehow like to manipulate it further so that I can do "x" with the highest value and "Y" with the lower value ..
For now this code just returns the numbers but im not sure what to do next. I really need to compare the values of the duplicated matches ..
Any help would be great..
Code:
Sub DuplicateSearch()
Dim lr, i, j, k, m As Long
Dim str As String, str2 As String
Dim vData, vResult As Variant
Dim vSearch, vOdd, vOdd2 As Variant
Dim sheet As Worksheet
Set sheet = ActiveWorkbook.Sheets("Matches")
lr = sheet.Cells(Rows.Count, "E").End(xlUp).Row
vResult = Range("J12:J" & lr)
vSearch = Range("E12:E" & lr)
vData = sheet.Range("A12:R" & lr)
vSearch = sheet.Range("A12:R" & lr)
For i = LBound(vData, 1) To UBound(vData, 1)
m = 0
str = vData(i, 5)
If Not IsNull(str) Then
For j = LBound(vData, 1) To UBound(vData, 1)
str2 = vSearch(j, 5)
If Not IsNull(str2) Then
If str = str2 Then
m = m + 1
End If
End If
Next j
End If
If m > 1 Then
vResult(i, 1) = vData(i, 14)
Range("J12:J" & lr) = vResult
End If
Next i
I was hoping someone could help me finish it as I'm stuck and don't know what to do. This code returns values if I have duplicates matches. as you can see I have it to return data from column N. I would somehow like to manipulate it further so that I can do "x" with the highest value and "Y" with the lower value ..
For now this code just returns the numbers but im not sure what to do next. I really need to compare the values of the duplicated matches ..
Any help would be great..