+ Reply to Thread
Results 1 to 4 of 4

Moving files with certain filename qualities to folders

  1. #1
    Registered User
    Join Date
    05-11-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Moving files with certain filename qualities to folders

    Good morning!

    Please note that I’m quite new to VBA in terms of serious projects. Basically I’m just trying to figure out if a project on which I want to work is even possible and, if so, what the best way to go about it would be:
    I have a folder full of .xls files which need to be distributed into other folders based on a number/letter string the middle of the filename.

    However, the specific folders into which they need to go is determined by a spreadsheet. The spreadsheet doesn’t say where the files need to go but it does say what properties the files have which would determine into which folder they’re being sent (ex: gender, department, etc.)

    Is it possible to integrate a macro into the spreadsheet with the properties, find a filename with the correct number string and then send that file to another folder? If so, what’s the best way to go about it?

    Many thanks!

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Moving files with certain filename qualities to folders

    Could you provide a sample list of filenames and the folders you want them put into?
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Registered User
    Join Date
    05-11-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Moving files with certain filename qualities to folders

    Quote Originally Posted by davegugg View Post
    Could you provide a sample list of filenames and the folders you want them put into?
    Certainly!

    The file name generally looks like: “Qualifier ABC Date.xls” where “ABC” is the string that I’d want my macro to hunt. You can then imagine a folder with 100+ files with different string permutations: that’s what I’m trying to get sorted into folders.

    The data itself looks something like this:

    ABC Date Male
    DEF Date Female
    GHI Date Male
    JKL Date Female
    MNO Date Male
    PQR Date Female

    So, what I’m trying to tell my macro is: For each letter string, find the file in folder “X” and then put it into either folder “Male” or folder “Female.”

    Does that help explain what I’m trying to accomplish?

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Moving files with certain filename qualities to folders

    Here is an example sheet showing how this would work. You'll have to modify it to fit your needs since you left out some details.
    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