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
<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>
</tbody>
Example of WorkBook B
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>
</tbody>
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
Code | Note 1 | Note 2 | Note 3 |
WELD | 1123 | 1145 | 1178 |
WELD | 1132 | 1147 | 1149 |
BB | |||
BEND | |||
EB | |||
WELD | 1156 | 1187 | 1173 |
<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>
</tbody>
Example of WorkBook B
NOTE 1 | NOTE 2 | NOTE 3 |
1123 | 1145 | 1178 |
1132 | 1147 | 1149 |
1156 | 1198 | 1173 |
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>
</tbody>
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