View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Miss Miss is offline
external usenet poster
 
Posts: 2
Default How to different value from duplicate selection - macro help

I am writing to seek help in updating the following code below, so the macro function allows me to look through data which have duplicate name values (from column A), to identify different rows of data from column J.

For example €“ please input sheet from the attachment. Code is behind input_data sheet.

Process €“ the macro, should look through lines of data which have duplicate name values (from column A), identify rows from column J are different from the duplicate values. The macro should highlight the difference in yellow, as final output.

Expected output €“ please see output sheet from the attachment.

sample file = https://app.box.com/s/xo11dikkydxl4v89i7kh664qjzfqnxku

Any help would be very much appreciated.


Sub checkCurr()
Dim coll As New Collection, arr, i As Long, strKey As String, v
With Sheets("Input_data").Range("A1").CurrentRegion
arr = .Value
For i = 2 To UBound(arr, 1)
strKey = arr(i, 1) & Chr$(2) & arr(i, 10)
On Error Resume Next
coll.Add Key:=strKey, Item:=Array(UCase$(arr(i, 11)), UCase$(arr(i, 12)))
If Err.Number = 457 Then
v = coll(strKey)
If UCase$(arr(i, 11)) < v(0) Or UCase$(arr(i, 12)) < v(1) Then .Rows(i).Interior.Color = RGB(255, 255, 0)
End If
On Error GoTo 0
Next i
End With
End Sub