Hello,

So I have a folder full of files with various names but all following the same pattern : SCR_text_12345-01 . I have a workbook that populates the last part of these names into column O using INDEX functions from another spreadsheet. What I want to do is go through the O column and when the contents there match that part of the file in the folder, move them to a different folder which is also created in the code. I have this so far...

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Sheets")

Dim Foldername As Integer
Foldername = Range("B2")

For Each ObjFile In objFolder.Files

Filepart = Left(Right(ObjFile.Path, 13), 8)

strFolderPath = "C:\Sheets" & Foldername & "\"

If Not objFSO.FolderExists(strFolderPath) Then
        Set objFolder2 = objFSO.CreateFolder(strFolderPath)
    End If
    
    
i = 2
If Cells(i, 16).Value = Filepart Then
objFSO.MoveFile ObjFile.Path, strFolderPath
End If
i = i + 1

Next
The folder gets created fine and the first file moves (the first one in the list populated in column O), but I don't know how to get the rest to move?!