Copy folder file names into a sheet

Javier F Lopez

New Member
Joined
Jul 8, 2008
Messages
3
Hi Everybody... i need your help. I'm "new" at VBA... i have a folder with a lot of files in it and i need to copy their names into a excel spread sheet... i think i could do it using something like... for each file y folder xx, copy filename... =)

Could you please help me?
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I've just done this for a client. Here is the code that I used. You will need to change the worksheet name from "Check" to whatever you have called your workbook.

Sub List_All_The_Files_Within_Path()
Dim Row_No As Integer
Dim No_Of_Files As Integer
Dim kk25 As Integer

Row_No = 6


With Application.FileSearch
.NewSearch
.LookIn = File_Path
.Filename = "*.*"
.SearchSubFolders = False
.Execute

No_Of_Files = .FoundFiles.Count


For kk25 = 1 To No_Of_Files
Worksheets("Check").Cells(kk25 + 5, 15).Value = .FoundFiles(kk25)

Next kk25


End With

End Sub

thanks

Kaps
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,449
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top