I have 2 sheets named orange book data alerts and total orange book data alerts , both sheets have data from A to M, unique value is in Column A in both the sheets. here I compare orange book data alerts with total orange book data alerts. When there is a match, compare its row cell values for each and every column and if there is difference the code should be written as Update in sheet orange book data alerts column N and if the unique value is not available it should write New addition in column N.. Below is code which i tried. it is working for if there is any update in data for one column, i need help so that i can compare all the columns and write as new addition if unique value is not present.
Sub compare10()
Dim w1 As Worksheet, w2 As Worksheet
Dim c As Range, a As Range
Set w1 = Sheets("total orange book data")
Set w2 = Sheets("orange book data alerts")
With w1
For Each c In .Range("a2", .Range("a" & Rows.Count).End(xlUp))
Set a = w2.Columns(1).Find(c.Value, lookat:=xlWhole)
If Not a is nothing then
if.cells(c.row,10).value<>w2.cells(a.row(a.row,10) then
w2.Cells(a.Row, 14).Value = "update"
End If
Next c
End With
End Sub
Rows.Countto run on. I assume it'll be.Range("a" & .Rows.Count).End(xlUp). Also, what'sIf.Cells(c.Row,10)....? I assume a typo when pasting to SO?