Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mike,
Thank's,but I don't get the file name list in my worksheet. Is there something I miss. Another request,I also want to add the creation date of the file in my list. Thank you. "Mike H" wrote in message ... Something went wrong in pasting this, try this instead Sub LoopThroughDirectory() Application.DisplayAlerts = False x = 1 MyPath = "C:\" 'Change this to your directory ActiveFile = Dir(MyPath & "*.xls") Do While ActiveFile < "" Cells(x, 1).Value = ActiveFile x = x + 1 ActiveFile = Dir() Loop Application.DisplayAlerts = True End Sub Mike "Mike H" wrote: Hi, If all you want is the filename then right click your sheet tab, view code and paste this in and run it. Change MyPath to your desired path Sub LoopThroughDirectory() Application.DisplayAlerts = False x = 1 MyPath = "C:\" 'Change this to your directory ActiveFile = Dir(MyPath & "*.xls") Do While ActiveFile < "" Cells(x, 1).Value = ActiveFile x = x + 1 ActiveFile = Dir() Application.DisplayAlerts = True End Sub Mike "asrul" wrote: Hi All, I want to listing all excel file in a directory. And put in a worksheet. How to code it. Thank's in advance |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Folder listing | Excel Worksheet Functions | |||
Listing Folder Contents into a Column | Excel Worksheet Functions | |||
Listing the contents of a folder | Excel Discussion (Misc queries) | |||
Followup: Folder listing | Excel Discussion (Misc queries) | |||
Listing files within a folder | Excel Programming |