Try to use the following code i am sure it will work for you.
Code:
Sub CompareSheets()
Dim Sh1LastRow As Variant
Dim Sh1Range As Range
Dim Sh1Cell As Range
Dim Sh2LastRow As Variant
Dim Sh2Range As Range
Dim c As Variant
With Sheets(1)
Sh1LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
Set Sh1Range = .Range("A1:A" & Sh1LastRow)
End With
With Sheets(2)
Sh2LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
Set Sh2Range = .Range("A1:A" & Sh2LastRow)
End With
'compare sheet 1 with sheet 2
For Each Sh1Cell In Sh1Range
Set c = Sh2Range.Find( _
what:=Sh1Cell, LookIn:=xlValues)
If c Is Nothing Then
Sh1Cell.Interior.ColorIndex = 3
Sh1Cell.Offset(0, 1).Interior.ColorIndex = 3 'Red
Else
If Sh1Cell.Offset(0, 1) <> c.Offset(0, 1) Then
Sh1Cell.Offset(0, 1).Interior.ColorIndex = 4 'Green
End If
End If
Next Sh1Cell
'compare sheet 2 with sheet 1
For Each Sh2Cell In Sh2Range
Set c = Sh1Range.Find( _
what:=Sh2Cell, LookIn:=xlValues)
If c Is Nothing Then
Sh2Cell.Interior.ColorIndex = 3
Sh2Cell.Offset(0, 1).Interior.ColorIndex = 3 'Red
Else
If Sh2Cell.Offset(0, 1) <> c.Offset(0, 1) Then
Sh2Cell.Offset(0, 1).Interior.ColorIndex = 4 'Green
End If
End If
Next Sh2Cell
End Sub
Bookmarks