开发者

Identify whether 2 excel documents share the same structure

开发者 https://www.devze.com 2023-01-17 15:48 出处:网络
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 d

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 开发者_Python百科special string property in the excel properties document, and check whether this is correct.

Any ideas ?

Regards,


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,

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号