Hi Joe,
This code will evaluate 2 fields and find matches or fields that don't match depending on your needs. Next, add the unmatched record to a new sheet or bold the record in code to identify records. Download zip file containing the code at www.jettechnical.com/sampletutorials/checkrecords.zip
Function FindUnmatchedRecords()
Dim strCompare As String
Dim strCompare1 As String
'set up the sheet you will be comparing to on the
'first cell to be checked
Range("A2").Select
'get the first sheet
Sheets("Sheet1").Select
'alter this to the column you want to compare.
'this assumes that row 1 will be the header
Range("A2").Select
'do until the field is empty
Do Until ActiveCell.Value = ""
strCompare = ActiveCell.Value
Sheets("Sheet2").Select
strCompare2 = ActiveCell.Value
If strCompare2 <> strCompare Then
Sheets("Sheet3").Select
ActiveCell.Value = strCompare2
'set up for the next record
ActiveCell.Offset(1, 0).Select
'go back to Sheet2
Sheets("Sheet2").Select
End If
'move to the next cell
ActiveCell.Offset(1, 0).Select
Sheets("Sheet1").Select
'move to the next cell
ActiveCell.Offset(1, 0).Select
Loop
End Function
To better understand how this works, open the project, open the macro (ALT + F11) , minimize the macro window so that you can see both the spreadsheet and the macro window. Place the cursore in the function and press F8 to step through the code and what how it executes. Then you'll be able to modify as you need.
Happy Coding!
Robert Pattinson