Perhaps a macro like this?
You will need to change
as well as
to the appropriate folders.
Based on your information this macro looks for Sheet1 and cell C4. If no sheet1 found it will show all sheets and you have to select one or the macro will fall flat on its feet. The way its set up it will find files ending in .xls, .xlsx and .xlsm
When moving files from source folder to target folder if conditions are met i.e. D4 = "CPA" this macro will not move the file if there is a file with the same name in the target folder.
Even if I have tested this macro I would strongly suggest you make a copy of the folder containing your data files!
When run the macro first loops through all files in "Mydir" and copies all file names and the D4 value from sheet1 to the workbook (sheet1) where you install this macro.
It then sets up an auto filter on sheet1 filters so only files with "CPA" in D4 are shown.
The result is copied to sheet2 and macro then loops through all file names on sheet2 at the same time moving the files.
Alf
Bookmarks