what I want is compare sheet1 each complete row with sheet2 complete rows if the data are same so put true in sheet3 and if it false then put false in sheet3

what I want is compare sheet1 each complete row with sheet2 complete rows if the data are same so put true in sheet3 and if it false then put false in sheet3
comparing sheet1 each row data with all rows in sheet2
means compare sheet1 1st complete row data with sheet2 1st row data ,and then compare sheet1 1st row data with sheet2 2nd row data and so on…….
see the attachment
result.xlsm
Avinash SinghAsked:
Who is Participating?
 
abbas abdullaConnect With a Mentor Commented:
Hi,
Check this code
Sub CompareMyDataByRows()
Dim ary1() As Variant, ary2() As Variant
Dim rng1 As Range, rng2 As Range, Sheet1RowNumber As Range, Sheet2RowNumber As Range
Set rng1 = Sheets("Sheet1").Range("A1:L16")
Set rng2 = Sheets("Sheet2").Range("A1:L16")

For x = 1 To 6

For i = 1 To 6

Set Sheet1RowNumber = rng1.Rows(x)
Set Sheet2RowNumber = rng2.Rows(i)
Debug.Print rng2.Rows(x).Address
ary1 = Application.Transpose(Application.Transpose(Sheet1RowNumber))
ary2 = Application.Transpose(Application.Transpose(Sheet2RowNumber))
Sheet1RowTxt = Join(ary1, "")
Sheet2RowTxt = Join(ary2, "")
u = Len(Sheet1RowTxt)
Debug.Print Sheet1RowTxt, Sheet2RowTxt
If Sheet1RowTxt = Sheet2RowTxt And u > 0 Then
Sheets("Sheet3").Cells(x, 2).Value = "True"
GoTo ExitLoop
ElseIf u <> 0 Then
Sheets("Sheet3").Cells(x, 2).Value = "False"

End If

Next
ExitLoop:
Next

End Sub

Open in new window

0
 
Avinash SinghAuthor Commented:
thnx alot sir for giving ur precious time in this post
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.