To display contents of a folder in an excel sheet using Excel MACRO

  • Thread starter Thread starter vishucool
  • Start date Start date
V

vishucool

Hi All,

i want to display some selected files (starting with a particular text)
from a folder to an excel sheet.
please tell me the MACRO code to implement the same.

Thanks,
Vishal
 
Enter your folder path in cell A1

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

Mat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top