+ Reply to Thread
Results 1 to 7 of 7

Move files to folders

  1. #1
    Registered User
    Join Date
    12-19-2010
    Location
    mumbai, India
    MS-Off Ver
    Excel 2003
    Posts
    71

    Move files to folders

    Hi Everyone,

    I have 8 folders on my desktop namely A, B, C, D, E, F, G & H. Path of these folders are

    A: C:\Users\hp\Desktop\Test 1\A
    B: C:\Users\hp\Desktop\Test 1\B
    C: C:\Users\hp\Desktop\Test 1\C
    D: C:\Users\hp\Desktop\Test 1\D
    and so on till folder H

    In another folder at different location i have 4 excel files namely W, X, Y & Z
    file path of these 4 files is : C:\Users\hp\Desktop\Test 2

    I am looking for a vba code that will copy file W to folder A and B both
    file X to folder C and D both,
    file Y to folder E and F both,
    file Z to folder G and H both.

    Kindly assist me in this.

    Thanks a lot in advance.

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    1,514

    Re: Move files to folders

    Obviously not tested...
    Please Login or Register  to view this content.
    ____________________________________________________________
    If I've been helpful, let me know. If I haven't, let me know that too.

  3. #3
    Registered User
    Join Date
    12-19-2010
    Location
    mumbai, India
    MS-Off Ver
    Excel 2003
    Posts
    71

    Re: Move files to folders

    Hi dangelor,

    Thnaks for the reply.

    I am geeting error as this step:
    FileCopy B & U(j), A & V(i)

    stating File not found. But i have Files in Folder Test 2

    Thanks,
    Saurabh

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    8,060

    Re: Move files to folders

    Please Login or Register  to view this content.
    Last edited by sintek; 09-16-2020 at 07:51 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere.....
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember......Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    1,514

    Re: Move files to folders

    I am geeting error as this step:
    FileCopy B & U(j), A & V(i)

    stating File not found. But i have Files in Folder Test 2
    I assumed W, X, Y and Z were placeholders for the real file names. Try replacing the letters in this line
    Please Login or Register  to view this content.
    with the actual file names.

  6. #6
    Registered User
    Join Date
    12-19-2010
    Location
    mumbai, India
    MS-Off Ver
    Excel 2003
    Posts
    71

    Re: Move files to folders

    Hi Sintek,

    This worked perfectly. Thank you so much for this.

    Just one change i want to do and that is, not necessary 1 excel workbook will go to 2 folders.

    Currently situation is
    File W should go to folder A & B
    File X should go to folder C D E and F
    Y should go to G H and I
    and File Z should go to folder J and K

    is it possible?

    Thanks in advance.

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    8,060

    Re: Move files to folders

    Perhaps...
    Please Login or Register  to view this content.
    Last edited by sintek; 09-16-2020 at 08:43 AM.

+ 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. VBA to MOVE pdf files between 2 folders
    By swilson2006 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-13-2018, 02:47 AM
  2. Auto move the files to desired folders
    By mylai in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-08-2017, 09:50 AM
  3. [SOLVED] Create Folders and Move Files
    By ascool_asice in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-17-2015, 06:50 AM
  4. [SOLVED] VBA to MOVE pdf files between 2 folders
    By sparx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2015, 03:53 PM
  5. Move Excel files from multiple folders to one
    By Azzzman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-04-2013, 10:21 AM
  6. How to Move specific files to folders with VBA
    By EnzioL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2012, 06:46 AM
  7. Create folders and move and copy files into that folders
    By vijaybharthi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-31-2010, 04:01 AM

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