Hi friend,
I have a excel file which contains 2 sheets & needs to be compared & diference needs to be highlighted.
I Have browsed the forum & found the foll. code but facing an issue. This code can compare & highlight the diference only if the data is small, say 1000 rows & columns till AZ. Bt I have a data of 6000 rows with columns names till GQ.
Pls help
Sub RunCompare()
Call compareSheets("Before", "After")
End Sub
Sub compareSheets(shtBefore As String, shtAfter As String)
Dim mycell As Range
Dim mydiffs As Integer
For Each mycell In ActiveWorkbook.Worksheets(shtAfter).UsedRange
If Not mycell.Value = ActiveWorkbook.Worksheets(shtBefore).Cells(mycell.Row, mycell.Column).Value Then
mycell.Interior.Color = vbYellow
mydiffs = mydiffs + 1
End If
Next
MsgBox mydiffs & " differences found", vbInformation
ActiveWorkbook.Sheets(shtAfter).Select
End Sub
Bookmarks