Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jul 2005
    Location
    Mandenville, Louisiana, USA
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    making a lit of files in a folder (excel)

    hello, was wondering if anyone knows a quick way of making a list of files in a folder. basical 1 file name= 1 cell and so on?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: making a lit of files in a folder (excel)

    This code will put a list of files in folder C:Work into column A of Sheet1. Caution!!!! It clears the contents of column A before making the list.

    <code>
    Public Sub ListFiles()
    Dim strFileName As String, strPath As String
    Dim I As Long
    I = 0
    strPath = "C:Work"
    With Worksheets("Sheet1")
    .Range("A:A").ClearContents
    strFileName = Dir(strPath & "*.*", vbNormal)
    Do While strFileName <> ""
    .Range("A1").Offset(I, 0).Value = strFileName
    strFileName = Dir()
    I = I + 1
    Loop
    End With
    End Sub
    </code>
    Legare Coleman

  3. #3
    Star Lounger
    Join Date
    Jul 2005
    Location
    Mandenville, Louisiana, USA
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: making a lit of files in a folder (excel)

    works well
    thanks very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •