I am trying to compare the differences of changed data on 2 sheets using the below VBA but am not getting it to work.
any help would be appreciated...thanks.
Sub Compare2()
Dim rngCell As Range
Sheets("sheet1").Select
finalRow = Range("A65536").End(xlUp).Row
For x = 2 To finalRow
sh1a = Range("b" & x).Value
sh1b = Range("f" & x).Value
Sheets("sheet2").Select
finalRow = Range("A65536").End(xlUp).Row
For y = 2 To finalRow
sh2a = Range("b" & y).Value
sh2b = Range("f" & y).Value
If sh1a = sh2a And sh1b = sh2b Then
For Each rngCell In Worksheets("Sheet1").Range("g" & x & ":j" & x)
If Not rngCell.Value = Worksheets("Sheet2").Cells("f" & y & ":j" & y).Value Then
rngCell.Interior.Color = vbYellow
End If
Next
End If
Next y
Next x
End Sub
any help would be appreciated...thanks.
Sub Compare2()
Dim rngCell As Range
Sheets("sheet1").Select
finalRow = Range("A65536").End(xlUp).Row
For x = 2 To finalRow
sh1a = Range("b" & x).Value
sh1b = Range("f" & x).Value
Sheets("sheet2").Select
finalRow = Range("A65536").End(xlUp).Row
For y = 2 To finalRow
sh2a = Range("b" & y).Value
sh2b = Range("f" & y).Value
If sh1a = sh2a And sh1b = sh2b Then
For Each rngCell In Worksheets("Sheet1").Range("g" & x & ":j" & x)
If Not rngCell.Value = Worksheets("Sheet2").Cells("f" & y & ":j" & y).Value Then
rngCell.Interior.Color = vbYellow
End If
Next
End If
Next y
Next x
End Sub