ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copy file names (https://www.excelbanter.com/excel-discussion-misc-queries/237355-copy-file-names.html)

americana

Copy file names
 
How can I copy the file names, within a folder, to another excel spreadsheet?

Otto Moehrbach[_2_]

Copy file names
 
This little macro will list all the files in the folder that holds the
file that has this macro in it. Change the folder as necessary. HTH Otto
Sub GetFileList()
Dim ThePath As String
ThePath = ThisWorkbook.Path
fname = Dir(ThePath & "\*.xls")
i = 1
Do While fname < ""
Range("A" & i) = fname
fname = Dir()
i = i + 1
Loop
End Sub

"americana" wrote in message
...
How can I copy the file names, within a folder, to another excel
spreadsheet?





All times are GMT +1. The time now is 07:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com