Hope you are doing great!
Would you please help me what code I can use to move files to their respective folders but using only the partial file name? I have successfully created the separate subfolders but I don't know how I will move the files to their respective folders. Here is my working file.
Here is my code to create their folders:
Sub MakeFolders()
Application.ScreenUpdating = False
Sheets("LIST").Select
Range("G12").Select
ActiveCell.Formula2R1C1 = _
"=UNIQUE(FILTER(RC[-2]:R[188]C[-2],RC[-2]:R[188]C[-2]<>""""))"
Range("G12").Select
Range(Selection, Selection.End(xlDown)).Select
Dim Rng As Range
Dim maxRows, maxCols, r, c As Integer
Set Rng = Selection
maxRows = Rng.Rows.Count
maxCols = Rng.Columns.Count
For c = 1 To maxCols
r = 1
Do While r <= maxRows
If Len(Dir(ActiveWorkbook.Path & "\" & Rng(r, c), vbDirectory)) = 0 Then
MkDir (ActiveWorkbook.Path & "\" & Rng(r, c))
On Error Resume Next
End If
r = r + 1
Loop
Next c
Sheets("LIST").Select
Range("G12").Select
Selection.ClearContents
MsgBox ("PM folders created.")
End Sub
What can I add here to move the files to that created folders?
Thank you so much!