Import file list

J

Josh Craig

Hi,

I want to know if it's possible to import a list of files in a given folder
to Excel. So, for example, I can have all the files in C:\documents\ listed
in column A in a worksheet. Is this possible?
 
M

Mallycat

I created a macro for another guy that wanted to do the same thing.
Here it is. Just enter your folder in cell A1 in the format
c:\windows\ making sure you put the \ at the end.

Sub myDIR()
myFolder = Range("A1").Value
x = 1
y = 1
Range("A2").Select
Selection = Dir(myFolder)
Do While y <> ""
y = Dir
Selection.Offset(x, 0).Value = y
x = x + 1
Loop
End Sub
 
R

Rich

this post was very usefull,, can the code be altered to show what is in any
sub-directory of the start folder >
 
Top