Ok so i have looked and looked and looked but cant come up with anything on the internet. So now I turn to you.
What i need to do is compare two different workbooks to find the unmatched info in Workbook A.
Example of WorkBook A
[TABLE="width: 256"]
<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]Code[/TD]
[TD="width: 64"]Note 1[/TD]
[TD="width: 64"]Note 2[/TD]
[TD="width: 64"]Note 3[/TD]
[/TR]
[TR]
[TD]WELD[/TD]
[TD="align: right"]1123[/TD]
[TD="align: right"]1145[/TD]
[TD="align: right"]1178[/TD]
[/TR]
[TR]
[TD]WELD[/TD]
[TD="align: right"]1132[/TD]
[TD="align: right"]1147[/TD]
[TD="align: right"]1149[/TD]
[/TR]
[TR]
[TD]BB[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]BEND[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]EB[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]WELD[/TD]
[TD="align: right"]1156[/TD]
[TD="align: right"]1187[/TD]
[TD="align: right"]1173
[/TD]
[/TR]
</tbody>[/TABLE]
Example of WorkBook B
[TABLE="width: 192"]
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]NOTE 1[/TD]
[TD="width: 64"]NOTE 2[/TD]
[TD="width: 64"]NOTE 3[/TD]
[/TR]
[TR]
[TD="align: right"]1123[/TD]
[TD="align: right"]1145[/TD]
[TD="align: right"]1178[/TD]
[/TR]
[TR]
[TD="align: right"]1132[/TD]
[TD="align: right"]1147[/TD]
[TD="align: right"]1149[/TD]
[/TR]
[TR]
[TD="align: right"]1156[/TD]
[TD="align: right"]1198[/TD]
[TD="align: right"]1173[/TD]
[/TR]
</tbody>[/TABLE]
I would like to highlight it in workbook a for the bad one
I found this online and it works only if they are in the same rows
What i need to do is compare two different workbooks to find the unmatched info in Workbook A.
Example of WorkBook A
[TABLE="width: 256"]
<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]Code[/TD]
[TD="width: 64"]Note 1[/TD]
[TD="width: 64"]Note 2[/TD]
[TD="width: 64"]Note 3[/TD]
[/TR]
[TR]
[TD]WELD[/TD]
[TD="align: right"]1123[/TD]
[TD="align: right"]1145[/TD]
[TD="align: right"]1178[/TD]
[/TR]
[TR]
[TD]WELD[/TD]
[TD="align: right"]1132[/TD]
[TD="align: right"]1147[/TD]
[TD="align: right"]1149[/TD]
[/TR]
[TR]
[TD]BB[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]BEND[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]EB[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]WELD[/TD]
[TD="align: right"]1156[/TD]
[TD="align: right"]1187[/TD]
[TD="align: right"]1173
[/TD]
[/TR]
</tbody>[/TABLE]
Example of WorkBook B
[TABLE="width: 192"]
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]NOTE 1[/TD]
[TD="width: 64"]NOTE 2[/TD]
[TD="width: 64"]NOTE 3[/TD]
[/TR]
[TR]
[TD="align: right"]1123[/TD]
[TD="align: right"]1145[/TD]
[TD="align: right"]1178[/TD]
[/TR]
[TR]
[TD="align: right"]1132[/TD]
[TD="align: right"]1147[/TD]
[TD="align: right"]1149[/TD]
[/TR]
[TR]
[TD="align: right"]1156[/TD]
[TD="align: right"]1198[/TD]
[TD="align: right"]1173[/TD]
[/TR]
</tbody>[/TABLE]
I would like to highlight it in workbook a for the bad one
I found this online and it works only if they are in the same rows
Code:
Option Explicit
Sub test()
Dim varSheetA As Variant
Dim varSheetB As Variant
Dim strRangeToCheck As String
Dim iRow As Long
Dim iCol As Long
strRangeToCheck = "A1:IV65536"
' If you know the data will only be in a smaller range, reduce the size of the ranges above.
Debug.Print Now
varSheetA = Worksheets("Sheet1").Range(strRangeToCheck)
varSheetB = Worksheets("Sheet2").Range(strRangeToCheck) ' or whatever your other sheet is.
Debug.Print Now
For iRow = LBound(varSheetA, 1) To UBound(varSheetA, 1)
For iCol = LBound(varSheetA, 2) To UBound(varSheetA, 2)
If varSheetA(iRow, iCol) = varSheetB(iRow, iCol) Then
' Cells are identical.
' Do nothing.
Else
' Cells are different.
Cells(iRow, iCol).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.Color = -16711681
.TintAndShade = 0
End With
End If
Next iCol
Next iRow
End Sub