Had a look at the files you uploaded and I’m not sure of how to tackle this part of the problem.
The “Dir” function sorts the file by name so even it your folder is sorted by date par instance the macro will pick the files in the order “Sorted by name”.
As your file name is a number i.e. 128897_090524 macro starts with the lowest number and work it ways upward to 129113_085530.
A possible solution is to add “Jan01_” to the first January file then “Jan02_” to the next file and so forth.
Another solution could be using a macro that imports all text file names from the folder to say B1 to B?? Sheet2:
You then sort the names in the order you wish to import the files. Macro can then be modified to read file name from B1 to B?? when importing to Excel.
Last solution (as I’m running out of ideas). Mark this thread as “Solved” and click on my star (bottom left) and give a rating to my answer.
Then starts a new thread called “Importing text files by date” and give examples of the file names and state you problem. You could also upload your present code for importing. Most likely some other forum member may then be able to help you.
Alf
Bookmarks