Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filenames into Excel
Using VBA, can anyone tell me know to get all the filenames in a given folder into an Excel spreadsheet. I would like to have each filename in a separate cell. For example, Filename1.txt in A1, Filename2.txt in A2, Filename3.txt in A3, etc. The number of data files (*.txt) will vary each day
Thanks in advance Lee |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Filenames into Excel
modify this to suit
Sub FindandListFiles() Application.ScreenUpdating = False Columns(1).ClearContents ThisRow = 2 Dim FN As String ' For File Name Dim ThisRow As Long Dim FileLocation As String FileLocation = "c:\yourfolder\*.txt" FN = Dir(FileLocation) Do Until FN = "" ThisRow = ThisRow + 1 Cells(ThisRow, 1) = FN FN = Dir Loop Application.ScreenUpdating = True End Sub -- Don Guillett SalesAid Software "Lee" wrote in message ... Using VBA, can anyone tell me know to get all the filenames in a given folder into an Excel spreadsheet. I would like to have each filename in a separate cell. For example, Filename1.txt in A1, Filename2.txt in A2, Filename3.txt in A3, etc. The number of data files (*.txt) will vary each day. Thanks in advance, Lee |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to save mp3 filenames in a cd to excel format | Excel Discussion (Misc queries) | |||
Copy Filenames AND details to Excel | Excel Discussion (Misc queries) | |||
using excel to rename filenames? | Excel Discussion (Misc queries) | |||
How to create Automatic Filenames in Excel | Excel Discussion (Misc queries) | |||
Brackets in Excel filenames | Excel Programming |