Help to copy from multiple excel files to master for each excel name to special sheets name

nhnn1986

Board Regular
Joined
Oct 12, 2017
Messages
92
Hi all

I have folder with over 3.000 excel files and I want to have vba code check file name in folder, if found will copy to special sheet like this:
Check excel file:
- If Begin with A00024 and have both column (B) and column(C) will copy range(C9:E11) to sheet(A00024). For example file name like: A00024-99201001-99201001-202012-SI-M-02.xlsx or A00024-99201001-99201001-201801-SI-M-01. xlsx
- If Begin with A00044 and have both column (B) and column(C) will copy range(C9:F783) to sheet(A00044)
- If Begin with C00203 and have both column (B) and column(C) will copy range(C9:C31) to sheet(C00203)
- If Begin with G00864 and have both column (B) and column(C) will copy range(B9:I73) to sheet(G00864)
- If Begin with G03625 and have both column (B) and column(C) will copy range(B9:D156) to sheet(G03625)

As you see in images belove, each value in column(B) will have 36 value in column(C), so the number of file I have to copy very much. Please help me to do this by VBA code.
Thanks./.
Master.xlsm
ABCDEF
1Check all file name in folder (over 3.000 excel files)
2A0002499902001202012Begin with A00024 and have both column (B) and column(C) will copy range(C9:E11) to sheet(A00024)
3A0004499902002202011A00024-99201001-99201001-202012-SI-M-02
4C0020399902003202010…..
5G0086499902004202009A00024-99201001-99201001-201801-SI-M-02
6G0362599902005202008Begin with A00044 and have both column (B) and column(C) will copy range(C9:F783) to sheet(A00044)
799902006202007Begin with C00203 and have both column (B) and column(C) will copy range(C9:C31) to sheet(C00203)
899902007202006Begin with G00864 and have both column (B) and column(C) will copy range(B9:I73) to sheet(G00864)
999902008202005Begin with G03625 and have both column (B) and column(C) will copy range(B9:D156) to sheet(G03625)
1099902009202004
1199902010202003
1299902011202002
1399902012202001
1499902013201912
1599902014201911
1699902015201910
1799902016201909
1899902017201908
1999902018201907
2099902019201906
2199902020201905
2299902021201904
2399902022201903
2499902023201902
2599902024201901
26201812
27201811
28201810
29201809
30201808
31201807
32201806
33201805
34201804
35201803
36201802
37201801
Main
 
Last edited:

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hi,​
may be easily achieved if at least the column D contains the source range address to copy like in cell D2 for example C9:E11 …​
Remind your need and well elaborate it or you will have to amend any solution, not a concern if you are very confident with your VBA skills !​
 
Upvote 0
Thanks @Marc L for reply. My Folder over 3.000 excel files like this:
folder
folder.jpg
 
Upvote 0
Any answer to my questions ? As guessing can't be coding !​
Now it depends also on at least on another forum where your create a similar thread …​
 
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,025
Members
452,542
Latest member
Bricklin

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