Sub CheckandSend()
Dim strfile As String
Dim ws As Worksheet 'make sure to define a sheet
Set ws = ThisWorkbook.Worksheets("RFQ")
Sheets("RFQ").Select
Dim Sourcepath As String
Sourcepath = "P:\CENTRAL PLANNING\PROJECTS 2020-2021\VALEO FRANCE 35101380FM\Drg folder\"
Dim destpath As String
destpath = "P:\CENTRAL PLANNING\PROJECTS 2020-2021\VALEO FRANCE 35101380FM\New folder1\"
'make sure paths end with \
Dim irow As Long
Dim f As SearchFolders
Dim filetype As String
filetype = "*.pdf"
irow = 7
Do While ws.Cells(irow, 2) <> vbNullString
Dim FileName As String
FileName = Dir(Sourcepath & ws.Cells(irow, 2) & "*.pdf")
'this will only go through pdf files
Do While FileName <> vbNullString
'if more files with the key word from ws.Cells(iRow, 2) exist copy all of them
VBA.FileCopy Sourcepath & FileName, destpath & FileName
'copy needs to be path AND filename
FileName = Dir()
Loop
irow = irow + 1
Loop
Sheets("RFQ").Select
Columns("AB:AG").Select
Selection.Delete
End Sub
on here , this code is help me to find a pdf file which matches my excel cell data and after that finding a file it will copy that particular file and paste in the destination folder
my issue is my file name in excel will look like AVRO15VE1522A, AVRO15VE1523B, AVRO15VE1524C , (In the file name list, the last alphabet is revision it may change as A,B,C,D,E.....Z)
but in my folder the file name will be like AVRO15VE1522 A, (OR) AVRO15VE1522A, AVRO15VE1523 B, (OR) AVRO15VE1523B, sometimes multiple files with same file name will present ,so i want only one file on that particular file name
and if all the revision files which is AVRO15VE1522A, AVRO15VE1522B, AVRO15VE1522C, Is present in folder means , i want the code to take a file which matches my filename in excel range