+ Reply to Thread
Results 1 to 6 of 6

creating folders and subfolders

  1. #1
    Registered User
    Join Date
    07-29-2015
    Location
    Ireland
    MS-Off Ver
    MS Office 2007
    Posts
    5

    creating folders and subfolders

    Hi,

    How can I create folders and Subfolders in windows from an excel list. The sub folders all contain different folders.

    Example:
    column A contains subfolders and column b contains locations. I need the subfolders only to go into the location for that subfolder. example below

    test 1 dublin
    maintainance dublin
    help dublin
    pottery france
    sailing france

    thanks.

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: creating folders and subfolders

    use MKDIR
    http://www.techonthenet.com/excel/formulas/mkdir.php
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    07-29-2015
    Location
    Ireland
    MS-Off Ver
    MS Office 2007
    Posts
    5

    Re: creating folders and subfolders

    thanks for the reply, I can create a list of folders and subfolders from excel already but the problem is each folder contains all the subfolders.
    I need each folder only to contain the subfolders associated with that folder,

    Exampe: only folders associated with dublin go into dublin, etc by location.

    Column A Column B
    Dublin Test 1
    Dublin Test 2
    Dublin Test 3
    London Compliance
    London Applications

    Right now I have the below code, it inserts all folders without duplicates from column a but it inserts all subfolders under each folder from column a.
    I need to only insert test1,2,3 into dublin. compliance and applications into london. I have a long list of 362. is there a quick way to do this or just copy and paste.

    Sub CreateDirs()
    Dim R As Range, R2 As Range
    Dim RootFolder As String
    RootFolder = "C:\test3" '<<< CHANGE 1

    For Each R In Range("A1:A32") '<<< CHANGE 2
    For Each R2 In Range("B1:B362") '<<< CHANGE 3
    If Len(R.Text) > 0 Then
    On Error Resume Next
    MkDir RootFolder & "\" & R.Text
    MkDir RootFolder & "\" & R.Text & "\" & R2.Text
    On Error GoTo 0
    End If
    Next R2
    Next R
    End Sub

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: creating folders and subfolders

    Hi Lohara
    please put the code between code tags
    Try this code
    change the range and the path to suit you
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  5. #5
    Registered User
    Join Date
    07-29-2015
    Location
    Ireland
    MS-Off Ver
    MS Office 2007
    Posts
    5

    Re: creating folders and subfolders

    thank you soo much, that worked. It just saved me soo much time.

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: creating folders and subfolders

    You're welcome. Thanks for the feedback and for the rep. points

+ 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. Create folders in all the subfolders and move subfolders
    By Amarjeet Singh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-24-2015, 12:51 PM
  2. creating folders and subfolders using macros
    By mikmez in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-06-2014, 08:45 PM
  3. [SOLVED] VBA code to add folders and subfolders
    By rhlittau in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-25-2013, 06:57 PM
  4. [SOLVED] Creating Folders and Subfolders
    By matt1133 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-15-2013, 03:52 AM
  5. Listing folders and subfolders
    By brokenbiscuits in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-11-2011, 08:49 AM
  6. Creating folders and subfolders from excel file list
    By afaubert in forum Excel General
    Replies: 4
    Last Post: 11-08-2005, 07:50 PM
  7. [SOLVED] Traversing folders and subfolders
    By Michael in forum Excel General
    Replies: 2
    Last Post: 11-02-2005, 06:17 PM

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