VBa check all file name in folder then copy range to Master workbook if meet

excel_newbie86

New Member
Joined
Aug 1, 2020
Messages
17
Office Version
  1. 2016
  2. 2007
Platform
  1. Windows
Hi all

I want to have macro check 6 character all excel files in Folder then copy range to master if meet
If left(filename,6) = "A12345" then copy sheet(A12345A).range(A10:I20) to workbook(master.xlsm).sheets(A12345)
If left(filename,6) = "B23456" then copy sheet(B23456B).range(A10:D15) to workbook(master.xlsm).sheets(B23456)
If left(filename,6) = "C34567" then copy sheet(C34567C).range(A10:E30) to workbook(master.xlsm).sheets(C34567)

Folder have over 500 excel files, some of them has character "A12345" or "B23456" or "C34567"
Thanks and please help me.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

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