+ Reply to Thread
Results 1 to 5 of 5

Copying only specific file names from a directory based on Excel Sheet

  1. #1
    Registered User
    Join Date
    05-28-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    90

    Copying only specific file names from a directory based on Excel Sheet

    I have a "file dump" directory with 6000+ files in it.

    I have an Excel file with a list of specific file names (qty 1700) which I need to pull (or copy) from that original "file dump" directory and drop into a new specified directory so I can upload them to a server.

    Does anyone have a VBA macro to do this? The file names between the Excel file and the directory match up exactly, but I just need the macro to look up only the files in the list.
    Last edited by pynergee; 01-20-2016 at 12:21 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying only specific file names from a directory based on Excel Sheet

    1) Assuming the SOURCE path is in A1
    C:\Path\To\6000\Files\

    2) Assuming the DESTINATION path is in A2
    C:\Path\To\New\Folder\

    3) Assuming the first filename is in A4 and the list goes down from there

    MyFile1.xlsx
    MyFile2.xlsx
    MyFile233.xlsx
    etc....

    4) That code would look like this:

    Please Login or Register  to view this content.
    Hopefully you can edit that for your actual need/layout.


    Notice
    - The paths have an \ at the end
    - column B will be marked with "not found" if needed.
    Last edited by JBeaucaire; 01-20-2016 at 12:07 PM. Reason: Correction
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    05-28-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    90

    Re: Copying only specific file names from a directory based on Excel Sheet

    I have the source for copy in A1, the Destination path in A2, and then all the file names starting in A4.

    When I step into the code though, I am getting a Run-time error '438' (Object doesn't support this property or method) after:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copying only specific file names from a directory based on Excel Sheet

    That line of code is corrected above. My apologies.

  5. #5
    Registered User
    Join Date
    05-28-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    90

    Re: Copying only specific file names from a directory based on Excel Sheet

    That worked perfectly. Thank you for your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copying file names from a directory to Excel
    By paperwings25 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-17-2013, 10:19 AM
  2. [SOLVED] Importing specific data from multiple text files in a file directory into excel
    By abat in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-03-2013, 05:26 PM
  3. Copying different CSV File and paste into the workbook in different sheet with names
    By jaffirahamed1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2011, 04:38 AM
  4. Finding file names in a directory
    By wilro85 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2008, 05:17 PM
  5. Get file names from a directory
    By paulmezick in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2008, 11:44 AM
  6. Import file size and file names from a directory
    By zahid in forum Excel General
    Replies: 1
    Last Post: 02-07-2006, 09:35 AM
  7. [SOLVED] to convert all the file names in one directory to .xls?
    By S.G.Pillai in forum Excel General
    Replies: 2
    Last Post: 09-27-2005, 01:05 PM
  8. Getting file names in a directory
    By John in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-08-2005, 12:06 PM

Tags for this Thread

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