Click here to Skip to main content
15,900,815 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
Hello,
im writing a solution for my boss, but i am struggled with a piece of the solution.. ill explain.

i have 2 excell sheets (file1.xls, file2.xls).
both files contain 2 columns, the first collumn contains variableNames, the 2nd collumn contains the value(data)(numeric).
the 1st collumns of the 2 files are exactly the same.

now i want to write a script that compares the 2 files, then write all the differences into a 3rd file (file3.xls).
somehow i cant imagine a way how to accomplish this.

the nicest thing is a code that i can implement in a new excell sheet(compare.xls) but it may also be a visualStudio script or vb6 or anything else vb (except ASP).

here is an example of how the files look:

http://www.catteryyelan.nl/images/question.png[^]

thnx in advance,
Tommy
Posted
Updated 13-Apr-11 22:48pm
v2

1 solution

 
Share this answer
 
Comments
garrox 14-Apr-11 15:16pm    
yeh, thats a very good idea of what i want
now i added the code to my workbook as macro and altered the last line thus:

CompareWorksheets ActiveWorkbook.Worksheets("Sheet1"), _
Workbooks(ActiveWorkbook.Path & "\File2.xls").Worksheets("Sheet1")

now i get the following error: Run-time error '9': Subscript out of range

i cant get it to work. File2.xls is in the same directory as the active workbook.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900