+ Reply to Thread
Results 1 to 6 of 6

Creating an Excel list of Excel Files

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    macro to list files

    Hi
    Replace filepath from D:\my documents\ to your folder path and runt the macro
    Sub List_files()
    Dim  x As Integer
    Dim f As String
    Cells(2, 1).Select
    f = Dir("D:\my documents\" & "*.xls")
    Do While Len(f) > 0
    ActiveCell.Formula = f
    ActiveCell.Offset(1, 0).Select
    f = Dir()
    Loop
    End Sub
    ravi

  2. #2
    Registered User
    Join Date
    05-28-2008
    Posts
    20
    for some reason it doesn't seem to work. When I run it, it moves down one row with blanks. I realized that they aren't .xls, they're .txt. So i changed the .xls -> .txt.

    Why doesn't this still work?

  3. #3
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    List Filenames

    Code provided by Macdave works fine.
    Look at the attached example.
    Enter your path name in K1 [e.g. C:\Sales\Reports] and file type in K3 [e.g. .Doc].
    And click the button.
    List appears in column A.
    modytrane
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1