Brondahl
Brondahl

Reputation: 8557

How can I simply check whether two Excel files are the same, or not

I don't want to know WHAT are the differences, I just want to know "Y/N Are these sheets identical?"

Unfortunately, superficially Hashing the file doesn't answer that :(

Specifically ...

So, evidently Excel just doesn't save the file in a stable manner. (or the has includes the last-saved date?)

Is there any way to get a stable hash, based on the cell contents of a sheet?

Upvotes: 1

Views: 1480

Answers (1)

Jenn
Jenn

Reputation: 647

One option would be to use a macro to check the sheets. If the result of the counter is greater than 0 then the sheets are different.

'~~~> Set the counter to 0.
i = 0

'~~~ Begin a double loop.
For r = 1 To SourceR

    For c = 1 To SourceC

        '~~~> Compare each cell in the two sheets.
        If SourceWS.Cells(r, c) <> TargetWS.Cells(r, c) Then

            If SourceWS.Cells(r, c) <> SourceWS.Range("CheckForUpdates") Then

                '~~~> Increase the counter by 1.
                i = i + 1

            End If

        End If

    Next c

Next r

Upvotes: 0

Related Questions