Loading
Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports



Results 1 to 4 of 4

Thread: Compare two worksheets and highlight the one sheet’s difference from the other one

  1. #1
    Join Date
    12th August 2005
    Posts
    32

    Compare two worksheets and highlight the one sheet’s difference from the other one

    Does anyone know how to do this? Thank you for your great help!

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    17th July 2004
    Location
    Texas, USA
    Posts
    1,939

    Re: Compare two worksheets and highlight the one sheet’s difference from the other one

    THis code will compare all cells of sheet1 with sheet 2 and post diferences in sheet three. If you want to limit the area of sheet1 compared to sheet two then change the range.

    Code:
    Sub CompareWorkSheets()
    Dim c1 As Range
    Dim c2 As Range
    Dim RowPos As Long
    
    Sheet3.Range("A1") = "Row"
    Sheet3.Range("B1") = "Column"
    Sheet3.Range("C1") = "Sheet1"
    Sheet3.Range("D1") = "Sheet2"
    
    RowPos = 1
    
    For Each c1 In Sheet1.Range("A1:IV65535")  '<<<Change range as required
    
    If c1 <> Sheet2.Cells(c1.Row, c1.Column) Then
    
        'Record difference
        RowPos = RowPos + 1
        Sheet3.Cells(RowPos, 1) = c1.Row
        Sheet3.Cells(RowPos, 2) = c1.Column
        Sheet3.Cells(RowPos, 3) = c1
        Sheet3.Cells(RowPos, 4) = Sheet2.Cells(c1.Row, c1.Column)
        MsgBox "Found"
    End If
    Next c1
    
    End Sub
    Bill

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    17th July 2004
    Location
    Texas, USA
    Posts
    1,939

    Re: Compare two worksheets and highlight the one sheet’s difference from the other one

    Note that the code I previously posted does not check for diffreneces in formulas.

    Bill

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    12th August 2005
    Posts
    32

    Re: Compare two worksheets and highlight the one sheet’s difference from the other one

    Thank you so much. Bill! it works

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Replies: 6
    Last Post: August 18th, 2011, 19:04
  2. Replies: 1
    Last Post: June 14th, 2008, 10:20
  3. Replies: 2
    Last Post: May 27th, 2008, 02:04
  4. Compare Worksheets & Highlight 1 By Criteria
    By CClio333 in forum EXCEL HELP
    Replies: 10
    Last Post: February 18th, 2008, 22:08
  5. Compare Two Sheets For Difference
    By auracon in forum EXCEL HELP
    Replies: 2
    Last Post: September 7th, 2007, 06:23

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
  •  
porno