+ Reply to Thread
Results 1 to 8 of 8

Main Folder to Sub Folder

  1. #1
    Forum Contributor
    Join Date
    05-25-2020
    Location
    Madurai
    MS-Off Ver
    Excel 2010
    Posts
    136

    Post Main Folder to Sub Folder

    Hi,

    Please help me to create VBA code for the below.

    I have month wise Main Folders. Each main folders i am having sub folders. All Sub Folder having files

    I want to swap the folder structure. Above main folder as sub folder, above sub folder as main folder and copying all files.

    Folder Swap.PNG

    Currently
    Main Folder Name Sub Folder
    Apr'19 Apple
    Apr'19 Orange
    Apr'19 Tomotto

    May'19 Apple
    May'19 Orange
    May'19 Tomotto

    Jun'19 Apple
    Jun'19 Orange
    Jun'19 Tomotto




    Expected
    Main Folder Name Sub Folder
    Apple Apr'19
    Apple May'19
    Apple Jun'19

    Orange Apr'19
    Orange May'19
    Orange Jun'19

    Tomotto Apr'19
    Tomotto May'19
    Tomotto Jun'19


    Not sure whether its possible, if possible please help me for VBA Code

  2. #2
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Main Folder to Sub Folder

    Maybe something like this ?
    Please Login or Register  to view this content.
    The Path is a directory where your three main folders (Apr'19, May'19, Jun'19) exist.
    So if based on the code above, the code assumes that :
    There is a folder name "MAIN" on the desktop.
    There are three folders in MAIN folder which are Apr'19, May'19 and Jun'19 folder.
    There is no other folder and there isn't any file inside MAIN folder.

    Inside Apr'19 folder there is 3 sub-folders which are : Apple, Orange and Tomoto folder
    There is no other folder and there isn't any file inside Apr'19 folder.

    Inside May'19 folder there is 3 sub-folders which are : Apple, Orange and Tomoto folder
    There is no other folder and there isn't any file inside May'19 folder.

    Inside June'19 folder there is 3 sub-folders which are : Apple, Orange and Tomoto folder
    There is no other folder and there isn't any file inside Jun'19 folder.

    Whatever inside the Apple folder will be moved to a new folder
    Whatever inside the Orange folder will be moved to a new folder
    Whatever inside the Tomoto folder will be moved to a new folder

    That's if I'm not mistaken to get what you mean.
    Which actually I don't quite understand this :
    Currently
    Main Folder Name Sub Folder
    Apr'19 Apple
    Apr'19 Orange
    Apr'19 Tomotto
    How is it possible that there are folder with a same name in one directory ?

    So my guessing that what you mean is :
    There is ONE folder with a name : Apr'19,
    where inside this Apr'19 folder there are three folders with a name Apple, Orange, and Tomotto.
    Last edited by karmapala; 06-02-2020 at 09:02 AM.

  3. #3
    Forum Contributor
    Join Date
    05-25-2020
    Location
    Madurai
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Main Folder to Sub Folder

    Hi karmapala

    Excellent. Perfectly working as expected. Thank you so much for your kind help.......

  4. #4
    Forum Contributor
    Join Date
    05-25-2020
    Location
    Madurai
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Main Folder to Sub Folder

    Thread Marked as resolved. Rep Added.

  5. #5
    Forum Contributor
    Join Date
    05-25-2020
    Location
    Madurai
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Main Folder to Sub Folder

    Hi karmapala

    Can you help to make little change of providing browse folder option on the below line, instead hard coding the path

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Main Folder to Sub Folder

    Hi KKR1975,
    Quote Originally Posted by KKR1975 View Post
    Hi karmapala

    Can you help to make little change of providing browse folder option on the below line, instead hard coding the path

    Please Login or Register  to view this content.
    Maybe change this one line:
    Please Login or Register  to view this content.
    into
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Main Folder to Sub Folder

    You're welcome and thanks for the rep, KKR1975

  8. #8
    Forum Contributor
    Join Date
    05-25-2020
    Location
    Madurai
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Main Folder to Sub Folder

    Thanks Karmapala. Its worked.....

+ 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] Hyperlink all folder inside the main folder
    By misteyoso in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-16-2017, 09:21 PM
  2. [SOLVED] VBA Code to save to a folder within a folder within a folder all based on cell values.
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-24-2016, 04:24 PM
  3. Sum excel files in one folder to a main document outside of the folder
    By patel.1557 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-23-2014, 08:27 AM
  4. [SOLVED] VBA: Go Back A Folder and Get The Main Folder Name
    By sanjeevpandey in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-31-2013, 02:24 AM
  5. Improvement - Option To Nest Folders as Sub Folder Under a Main Folder / Heading
    By :) Sixthsense :) in forum Suggestions for Improvement
    Replies: 4
    Last Post: 01-28-2013, 07:09 AM
  6. Detect new drive if main folder is moved
    By JamesT1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-29-2012, 07:00 AM
  7. Replies: 6
    Last Post: 08-11-2006, 03:41 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