Copy worksheets from different directory to current workbook

Pumper

Board Regular
Joined
Sep 12, 2013
Messages
52
Office Version
  1. 2016
Hi All,

I am attempting to use VBA to search a directory for files that contain certain text and yesterdays date in the file name (date format is dd-mmm-yyyy, work days only ideally) and paste into the current workbook.

Have found similar threads here but not quite the same and after countless videos and attempts I am asking the experts :)

All of the source files are in the same directory G:\Data\Prices​
Current workbook where the data should be copied to is called Master.xlsm and is in G:\All\Masterfiles​
If the file name contains the text "Warning" and yesterdays date then copy to the current workbook in tab "Check" in cell A1​
If the file name contains the text "Direct" and yesterdays date then copy to the current workbook in tab "Exposure" in cell A2 (has a heading in row 1 so needs to be from A2)​
Any assistance is much appreciated, even a link to a similar example would be helpful.

Thanks in advance.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Watch MrExcel Video

Forum statistics

Threads
1,132,980
Messages
5,656,203
Members
418,289
Latest member
Kjohno

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
Top