1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| sheetOne.Select
'Look for match between Sheet1 and Sheet2 in Column A From Cell A3
For i = 3 To sheetOne.Range("a" & Rows.Count).End(xlUp).Row
If Application.CountIf(sheetTwo.Range("a:a"), Cells(i, "a")) <> 0 Then
Cells(i, "a").Select
'If Match, highlight the cell A in Yellow and Filter in Sheet2
' Selection.Interior.ColorIndex = 6
sheetTwo.Select
Range("$A$2:$IV$2000").AutoFilter Field:=1, Criteria1:=sheetOne.Cells(i, "a").Value
With sheetTwo.Range("a:a")
x = [A:A].Find(What:=(sheetOne.Cells(i, "a").Value), LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns).Row
End With
'If Value is Different between sheet1 and sheet2, highlight the cell(s) in Red
For j = 3 To 256
' If sheetOne.Cells(i, j).Value <> "" And sheetOne.Cells(i, j).Value <> sheetTwo.Cells(x, j).Value Then
If sheetOne.Cells(i, j).Value <> sheetTwo.Cells(x, j).Value Then
sheetOne.Cells(i, j).Interior.ColorIndex = 3
End If
Next j
sheetOne.Select
End If
Next i |
Partager