I need to dynamically select the range of two excel sheets and do a row by row comparison and print it in a report sheet something like true or false using excel VBA macro.. pls help.. VBA Macro to compare all cells of two Excel files this link was helpful, but i wanted to dynamically select the range and also need to print some TRUE/FALSE in comparison sheet.
I exactly wanted to load the sheets to variant array and then loop through them for fast performance of the code.
Note - please assume that both the sheets needs to be compared contains same no of rows and are sorted.
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.
' i want to go to the exact cell in Comparison sheet and type TRUE Else
' Cells are different.
' i want to go to the exact cell in Comparison sheet and type FALSE
End If
Next iCol
Next iRow