• Great tool.

    I'm already started using it and it's a charm.

    I made some changes for mine so that it could work in any workbook regardless of the names of the sheets. It will do the campare on the first 2 sheets in the active workbook.

    I've pasted my code under my personal xls modules so that my macro becomes global.

    Here is the modified code if anyone is interested:

    ' Clear all the indicators that previous comparisons may have set.

    Private Sub ClearMarkers()

    ' Clear Sheet1

    'ThisWorkbook.Sheets.Select

    ActiveWorkbook.Sheets(1).Activate

    ActiveWorkbook.ActiveSheet.Cells.Select

    Selection.Interior.ColorIndex = xlNone

    Selection.Font.ColorIndex = 0

    ActiveWorkbook.ActiveSheet.Cells(1, 1).Select ' undo selection of entire sheet

    ' Clear Sheet2

    ActiveWorkbook.Sheets(2).Activate

    ActiveWorkbook.ActiveSheet.Cells.Select

    Selection.Interior.ColorIndex = xlNone

    Selection.Font.ColorIndex = 0

    ActiveWorkbook.ActiveSheet.Cells(1, 1).Select ' undo selection of entire sheet

    End Sub

    ' Walk through Sheet1 and Sheet2, setting markers wherever differences

    ' in cell contents are found.

    Public Sub Diff_Sheet_1_and_2()

    On Error GoTo ErrHandle

    Call ClearMarkers

    ' Determine range of used cells, using the highest row and column counts

    ' found in either of the two sheets.

    Dim HighRow As Long

    HighRow = ActiveWorkbook.Sheets(1).UsedRange.Rows.Count

    If ActiveWorkbook.Sheets(2).UsedRange.Rows.Count > HighRow Then

    HighRow = ActiveWorkbook.Sheets(2).UsedRange.Rows.Count

    End If

    Dim HighCol As Long

    HighCol = ActiveWorkbook.Sheets(1).UsedRange.Columns.Count

    If ActiveWorkbook.Sheets(2).UsedRange.Columns.Count > HighCol Then

    HighCol = ActiveWorkbook.Sheets(2).UsedRange.Columns.Count

    End If

    ' Walk through the cells of both sheets, comparing and changing colors

    ' if differences are found.

    Dim RowIndex As Long

    Dim ColIndex As Long

    Dim RowFirst As Long

    Dim ColFirst As Long

    For RowIndex = 1 To HighRow

    For ColIndex = 1 To HighCol

    ' Compare formulas, not "text" or other formatting-affected attributes.

    If ActiveWorkbook.Sheets(1).Cells(RowIndex, ColIndex).Formula <> ActiveWorkbook.Sheets(2).Cells(RowIndex, ColIndex).Formula Then

    ' Determine how to indicate the difference on Sheet1.

    If ActiveWorkbook.Sheets(1).Cells(RowIndex, ColIndex).Text = "" Then

    ' If the cell contains no text, highlight the empty cell.

    ActiveWorkbook.Sheets(1).Select

    ActiveWorkbook.Sheets(1).Cells(RowIndex, ColIndex).Select

    Selection.Interior.ColorIndex = 38

    Else

    ' If the cell contains text, color the text.

    ActiveWorkbook.Sheets(1).Cells(RowIndex, ColIndex).Font.Color = &HFF

    End If

    ' Determine how to indicate the difference on Sheet2.

    If ActiveWorkbook.Sheets(2).Cells(RowIndex, ColIndex).Text = "" Then

    ' If the cell contains no text, highlight the empty cell.

    ActiveWorkbook.Sheets(2).Select

    ActiveWorkbook.Sheets(2).Cells(RowIndex, ColIndex).Select

    Selection.Interior.ColorIndex = 38

    Else

    ' If the cell contains text, color the text.

    ActiveWorkbook.Sheets(2).Cells(RowIndex, ColIndex).Font.Color = &HFF

    End If

    ' If this is the first row containing a difference, remember the cell

    ' in which the change occurred so we can return to it later.

    If RowFirst = 0 Then

    RowFirst = RowIndex

    ColFirst = ColIndex

    End If

    End If

    Next

    Next

    ' Either report no differences or focus on the first difference found.

    If RowFirst = 0 Then

    MsgBox "No differences!"

    Else

    If ActiveWorkbook.ActiveSheet.Index = 1 Then

    ActiveWorkbook.Sheets(1).Cells(RowFirst, ColFirst).Activate

    End If

    If ActiveWorkbook.ActiveSheet.Index = 2 Then

    ActiveWorkbook.Sheets(2).Cells(RowFirst, ColFirst).Activate

    End If

    End If

    Exit Sub

    ErrHandle:

    MsgBox Err.Description

    End Sub

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life