0

I need to find a way to identify if 2 Excel documents are basically based on the same nomenclature.

The first document need to load data from the second one. And I want to make sure that the first document is correctly trying to load relevant data.

Is there a clever way in order to do so ?

My very primal thinking at the moment would be to look in the excel document for specific string that would need to be the same. Or setting a special string property in the excel properties document, and check whether this is correct.

Any ideas ?

Regards,

Farid
  • 1,542
  • 3
  • 18
  • 27
  • 1
    Could you be more specific or, better yet, provide some code. VBA isn't very good at checking for "basically" the same material. The documents are or aren't the same, or you would have to explicitly provide the variations. – ForEachLoop Sep 24 '10 at 14:02
  • By nomenclature do you mean headings and such like? It is not too difficult to compare specific parts of a sheet. – Fionnuala Sep 24 '10 at 14:23
  • Basically at the moment I would need to check that 2 specifics columns are the same in both documents. These columns can have millions of rows ... – Farid Sep 24 '10 at 15:01
  • If by the same, you mean identical, consider ADO and an INNER JOIN on the two columns. – Fionnuala Sep 24 '10 at 19:23

1 Answers1

0

Here is what I was looking for :

' Loop through each cell in first Range and compare it with
' each cell in second one.
Function isIdentic(Range As Range, RangeB As Range)

isIdentic = True
Dim counter As Long
counter = 1

For Each Value In Range
toCompare = RangeB.Cells(counter)

    If Value <> toCompare Then
'print the values which are different
    MsgBox Value & " : " & toCompare
    isIdentic = False
    Exit For
    End If

counter = counter + 1
Next Value

End Function

If any advice please share !

Regards,

Farid
  • 1,542
  • 3
  • 18
  • 27