reachmanoj27
New Member
- Joined
- Aug 31, 2016
- Messages
- 6
[FONT=Arial, Helvetica Neue, Helvetica, sans-serif]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 [/FONT]orange book data alerts[FONT=Arial, Helvetica Neue, Helvetica, sans-serif] with [/FONT]total orange book data alerts.[FONT=Arial, Helvetica Neue, Helvetica, sans-serif] 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 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.
[/FONT]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
[/FONT]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