PDA

View Full Version : [SOLVED] VBA to compare sheet 1 and sheet 2



parscon
10-29-2013, 04:14 AM
Hi
I need a VBA code that compare column A on Sheet1 and Column A on sheet 2 and if find matched data add "Matched" in column B on sheet 1 and it must be Unicode support.
Hope you will understand.
It will be very big help for me .
Thank you very much .

mancubus
10-29-2013, 03:17 PM
hi.

can you upload your file with sample data?

parscon
10-30-2013, 12:51 AM
It is Done

Thank you



Sub blah()
With Sheets("Sheet1")
For Each rw1 In Intersect(.UsedRange.EntireRow, .Range("A:A")).Rows
For Each rw2 In Intersect(Sheets("Sheet2").UsedRange.EntireRow, Sheets("Sheet2").Range("A:A")).Rows
For i = 1 To 1
If Not rw1.Cells(i) = rw2.Cells(i) Then Exit For
Next i
If i = 2 Then .Cells(rw1.Row, "B").Value = "MyDATA"
Next rw2
Next rw1
End With
End Sub