Scan Excel Files and Find Differences

bobgoblin12

New Member
Joined
May 10, 2016
Messages
7
I have two directories one called Orig and one called New

Each one of these will have two sub-dirs, and should have the exact same file names, with the exact same contents on
Sheet1 - columns A - column BG
Sheet2 - columns A - column K
Sheet3 - columns A - column L


How can I se Excel VBA to compare each file in the Orig to the New directory and ensure that the file contents are the same?
If the file names and contents match 100% i'd like to add the file names to a worksheet called match
If the file names and contents do NOT match I'd like to add the file names to a worksheet called Error
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I have two directories one called Orig and one called New

Each one of these will have two sub-dirs, and should have the exact same file names, with the exact same contents on
Sheet1 - columns A - column BG
Sheet2 - columns A - column K
Sheet3 - columns A - column L


How can I se Excel VBA to compare each file in the Orig to the New directory and ensure that the file contents are the same?
If the file names and contents match 100% i'd like to add the file names to a worksheet called match
If the file names and contents do NOT match I'd like to add the file names to a worksheet called Error
what exactly do you want to compare with 2 files? just values or all contents like color, shapes,...?
 
Upvote 0
Not a problem if you read everything into variables and then close the files again.

Although the best way is to use power query
 
Upvote 0
Not a problem if you read everything into variables and then close the files again.

Although the best way is to use power query
yes, you can do that with class module for dynamic worksheet, but save as different name is easy to solve this problem
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,182
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top