2つのExcelシートの範囲を動的に選択し、行ごとの比較を行い、Excel VBAマクロを使用してtrueまたはfalseのようなレポートシートに印刷する必要があります.. pls help.. 2つのExcelファイルのすべてのセルを比較するVBAマクロ このリンクは役に立ちましたが、範囲を動的に選択し、比較シートに TRUE/FALSE を印刷する必要もありました。
シートをバリアント配列にロードし、それらをループしてコードのパフォーマンスを高速化したかったのです。
注 - 比較する必要がある両方のシートに同じ行数が含まれており、並べ替えられていると想定してください。
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