M
Michael
Assuming I have some xls files in C:\Folder the code below will list them
one by one in Sheet1 starting from cell A1.
Set ListPointer = Sheets("Sheet1").Range("A1")
FileName = Dir(Range("C:\Folder") & "\*.*")
Do While FileName <> ""
If Right(FileName, 4) = "." & Range("xls") Then
ListPointer = FileName
Set ListPointer = ListPointer.Offset(1, 0)
End If
FileName = Dir()
Loop
What if I have sub folders e.g. C:\Folder\SubFolder1 and
C:\Folder\SubFolder2 with lots of .xls files below them. How can I write a
simple loop to traverse all of the files in all folders and subfolders below
c:\Folder and list them in one range?
Thanks in advance
Michael
one by one in Sheet1 starting from cell A1.
Set ListPointer = Sheets("Sheet1").Range("A1")
FileName = Dir(Range("C:\Folder") & "\*.*")
Do While FileName <> ""
If Right(FileName, 4) = "." & Range("xls") Then
ListPointer = FileName
Set ListPointer = ListPointer.Offset(1, 0)
End If
FileName = Dir()
Loop
What if I have sub folders e.g. C:\Folder\SubFolder1 and
C:\Folder\SubFolder2 with lots of .xls files below them. How can I write a
simple loop to traverse all of the files in all folders and subfolders below
c:\Folder and list them in one range?
Thanks in advance
Michael