Search files in folder for specific text

rjplante

Well-known Member
Joined
Oct 31, 2008
Messages
569
Office Version
  1. 365
Platform
  1. Windows
I have a file folder that has several files in them. I also have a list of 12 text strings in range L3:M14 Four of my strings have text in column L and column M, the Text in column L is found at the front of the file name and the text in column M is found at the end of the file name (e.g. L7 contains the text "Mast", and M7 contains "L1L2", L8 contains "Mast", and M8 contains "L3L4". I would like to have a macro that searches the files found in the folder listed in cell C8 for the text in the range L3:M14. When the first one is found I need it to open the file and then execute a specific range copy and paste into my workbook in a defined tab and defined range. Once the first file is done, I need it to close that file and loop through my text range L3:M14 for the file whose filename matches the next item on the list. Most of these files are in pairs and have identical paste ranges, just in a different tab.

What I need is a way to locate a specific file using the search terms in range L3:M14.

Data Table:
Files to extract data from contain:
Labels 1
Labels 2
Labels 3
Labels 4
MastL1L2
MastL3L4
TuckL1L2
TuckL3L4
SOP 1
SOP 2
TrvDate 1
TrvDate 2


Location of files:
Data Folder:C:\Users\JSmith\Desktop\blank\
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

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