Results 1 to 2 of 2

Table differences

Threaded View

  1. #1
    Registered User
    Join Date
    07-22-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    22

    Table differences

    Hi,

    I want the list of differences between the two table files to be listed in the other file and I want the master tables to be highlighted in two different colors for differences less than or equal to 1 (orange) and differences more than 1 (yellow). Please find the attached files for an example of how I need it. Previously I got the below mentioned code from this forum but I wanted few more things in a similar fashion.

    1. Coloring
    2. Finding differences from two different files (previously it was done within the file).
    2. If there are any words which are different between the two tables, I get a error message (I only want the values and words needs to be skipped).

    Sub Test()
    Sheets("Result").Activate
    Rows("2:" & Rows.Count).ClearContents
    For M = 2 To Sheets("Table 1").Cells(1, Columns.Count).End(xlToLeft).Column
        For N = 2 To Sheets("Table 1").Cells(Rows.Count, 1).End(xlUp).Row
            If Sheets("Table 1").Cells(N, M) <> Sheets("Table 2").Cells(N, M) Then
                Cells(Rows.Count, 1).End(xlUp).Offset(1, 0) = Cells(Rows.Count, 1).End(xlUp).Row
                Cells(Rows.Count, 1).End(xlUp).Offset(0, 1) = Sheets("Table 1").Cells(N, 1) & " - " & Sheets("Table 1").Cells(1, M)
                Cells(Rows.Count, 1).End(xlUp).Offset(0, 2) = Sheets("Table 1").Cells(N, M)
                Cells(Rows.Count, 1).End(xlUp).Offset(0, 3) = Sheets("Table 2").Cells(N, M)
                Cells(Rows.Count, 1).End(xlUp).Offset(0, 4) = Sheets("Table 1").Cells(N, M) - Sheets("Table 2").Cells(N, M)
            End If
        Next N
    Next M
    End Sub
    Thanks,
    Yathish D

    Table 1.xlsxTable 2.xlsxTable difference.xlsm
    Last edited by Cutter; 08-08-2012 at 04:30 PM. Reason: Added code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1