Loop and match cell value in master file to file names in the folder and copy data from master file to each file in the folder

bebo201022

New Member
Joined
Sep 24, 2017
Messages
3
Hi all,

I just made a code to collect data from all excel sheets in one folder into one master file.


I need a code to reflect any update in the master file to all files in the folder.

So the code should check the column G starting from G7 and if data in G matches any file name in the folder, it should open the file and delete its contents starting from raw 7 and replace it with data from master file

EX.

G7:G12 contains data "Apple"
There are file called "Apple"

the code should open file "Apple" in the folder called " C:\My documents" and delete all file rows starting from row 7
and copy range row7:row12 from master file and paste it to "Apple" and save and close it


then loop for all files in the folder " C:\My documents"
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,224,765
Messages
6,180,845
Members
453,001
Latest member
coulombevin

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