How to List Files in a Folder and Sub-Folders in Excel VBA
The most common technique to list all of the files in a folder and all its sub-folders is known as recursion. Basically this means that a subroutine or function calls itself, which can be tricky to understand if you have not encountered recursion before.
The Excel VBA code below lists all of the file names found in the same folder as the folder in which the workbook is saved, plus all sub-folders.
Feel free to copy the Excel VBA code and adapt it as you see fit.