Quote Originally Posted by June7 View Post
See if this gets you started:
Sub CopyFiles()
    Dim strFolder As String, strFile As String, strPrefix As String
    Dim colFiles As New Collection, varItem As Variant, fso As FileSystemObject
    Set fso = CreateObject("scripting.filesystemobject")
    strFolder = "C:\folderpath"
    strFile = Dir(strFolder & "\*.*")
    Do While strFile <> vbNullString
        If strPrefix <> Left(strFile, 12) Then
            strPrefix = Left(strFile, 12)
            colFiles.Add strPrefix
        End If
        strFile = Dir
    Loop
    For Each varItem In colFiles
        If Dir(strFolder & "\" & varItem) = "" Then MkDir strFolder & "\" & varItem
        fso.CopyFile strFolder & "\" & varItem & "*", strFolder & "\" & varItem
    Next
End Sub
Many thanks for your help.
I am not very experienced, so please ignore my ignorance as much as you can.
I have started your script as macro from Excel.
I have changed folder path to "C:\Users\User\Desktop\Sort"
Compile error: user-defined type not defined (in script marked in red)
What can I do?