#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 78
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 78
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I get Excel 2007 to 'read' cell contents to me, vocally? johnb609 Excel Discussion (Misc queries) 1 May 4th 08 01:48 AM
read contents of col1 and extract similars Bob Excel Discussion (Misc queries) 3 November 5th 07 11:24 PM
read contents of col 1 and extract similar strings Bob Excel Discussion (Misc queries) 5 November 5th 07 11:21 PM
read contents of column 1 for particular string Bob Excel Discussion (Misc queries) 1 November 4th 07 10:18 PM
Excel formula to read contents Fiona Excel Discussion (Misc queries) 7 June 12th 07 05:35 PM


All times are GMT +1. The time now is 05:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"