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

Posted on 2018-03-08
Low Priority
Last Modified: 2018-03-09
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
Question by:Avinash Singh

Accepted Solution

abbas abdulla earned 1000 total points
ID: 42493497
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


End Sub

Open in new window


Author Closing Comment

by:Avinash Singh
ID: 42493818
thnx alot sir for giving ur precious time in this post

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Join & Write a Comment

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Are you looking to start a business? Do you own and operate a small company? If so, here are some courses you need to take before you hire a full-time IT staff.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question