![]() |
read fold contents
hi
I would like to read all the files in a folder the files beginning with a "W" i would like to copy the file name into excel as a list any ideas how this is done thanks kevin |
read fold contents
Hi,
Try this with the path changed to your required path Sub LoopThroughDirectory() Application.DisplayAlerts = False 'Change this to your directory MyPath = "C:\" activefile = Dir(MyPath & "*.xls") Do While activefile < "" If UCase(Left(activefile, 1)) = "W" Then Cells(Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1, 1) = activefile End If activefile = Dir() Loop Application.DisplayAlerts = True End Sub Mike "kevcar40" wrote: hi I would like to read all the files in a folder the files beginning with a "W" i would like to copy the file name into excel as a list any ideas how this is done thanks kevin |
read fold contents
On 10 Sep, 09:43, Mike H wrote:
Hi, Try this with the path changed to your required path Sub LoopThroughDirectory() Application.DisplayAlerts = False 'Change this to your directory MyPath = "C:\" activefile = Dir(MyPath & "*.xls") Do While activefile < "" * If UCase(Left(activefile, 1)) = "W" Then Cells(Cells(Cells.Rows.Count, "A").End(xlUp).Row + 1, 1) = activefile * End If activefile = Dir() Loop Application.DisplayAlerts = True End Sub Mike "kevcar40" wrote: hi I would like to read all the files in a folder the files beginning with a "W" i would like to copy the file name into excel as a list any ideas how this is done thanks kevin- Hide quoted text - - Show quoted text - thank you works a treat |
All times are GMT +1. The time now is 04:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com