3 Attachment(s)
Compare Multiple Columns in Multiple Sheets and Merge differences
I'm trying to compare the columns in two sheets for differences and similarities, using Column "B" as the reference to determine which records are the same and Column "F" to check if new changes were added to the current records. If some of the records in both columns are the same nothing happens but, if records in column "B" in sheet 1 and sheet 2 are the same and for the same row records in Column "F" are different between the 2 sheets then I need to copy the ones from sheet 2 and replace the ones in sheet 1.
I started working on the code but spent too much time sorting out the methods and watching tutorials, which landed me here asking for help, I'm attaching a sample of the document and the code that I was able to get so far, my problem is that I have it highlighting red to see if it finds what I'm asking for and it's doing it to everything.
Please help.
Code:
Option Explicit
Sub checkdifferences()
Dim LastPOcell As Integer
Dim LastAIRcell As Integer
Dim i As Integer
Dim j As Integer
LastPOcell = Cells(rows.Count, "B").End(xlUp).row
LastAIRcell = Cells(rows.Count, "F").End(xlUp).row
For j = 2 To LastAIRcell
For i = 2 To LastPOcell
If Sheets("Reversion").Cells(i, 2).Value = Sheets("Alpha").Cells(i, 2).Value & _
Sheets("Reversion").Cells(j, 2).Value <> Sheets("Alpha").Cells(j, 2).Value Then
Sheets("Alpha").Cells(i, 2).Font.Color = rgbRed
'Sheets("Alpha").Cells(i, 2).Copy
End If
Next i
Next j
End Sub