Here is some code to list files path, files names and date last modified from a specific folder. The folder path is on "e3" and the argument YES or NO is on e4, to include subfolders or not. I would like to add folders name on e5 (preferably separated by comma) that would be excluded from this list. Can you please help me write this code?
Sub ListFiles() iRow = 11 Call ListMyFiles(Range("e3"), Range("e4")) End Sub Sub ListMyFiles(mySourcePath, IncludeSubfolders) Set MyObject = New Scripting.FileSystemObject Set mySource = MyObject.GetFolder(mySourcePath) On Error Resume Next For Each myFile In mySource.Files iCol = 2 Cells(iRow, iCol).Value = myFile.Path iCol = iCol + 2 Cells(iRow, iCol).Value = myFile.Name iCol = iCol + 1 Cells(iRow, iCol).Value = myFile.DateLastModified iRow = iRow + 1 Next If IncludeSubfolders Then For Each mySubFolder In mySource.SubFolders Call ListMyFiles(mySubFolder.Path, True) Next End If End Sub