Results 1 to 7 of 7

Simple: Create folder based on cell value

Threaded View

  1. #3
    Valued Forum Contributor
    Join Date
    08-13-2012
    Location
    Gardony, Hungary
    MS-Off Ver
    Excel 2003
    Posts
    558

    Re: Simple: Create folder based on cell value

    Hi,

    this macro assumes that your folder names are in column F starting from F2 and there are no empty cells in the list. It will ask if you want to make the two sub folders.
    Sub mkDir_from_cell()
    
    Dim CellDir As String, MyMsg
    Dim i As Integer, x
    
    For i = 2 To ActiveSheet.Cells(Rows.Count, "F").End(xlUp).Row
        CellDir = ActiveSheet.Cells(i, "F").Value
        If Len(Dir("E:\Users\Corp Est\LM Region\PROJECTS\" & CellDir, vbDirectory)) = 0 Then
            mkdir "E:\Users\Corp Est\LM Region\PROJECTS\" & CellDir
            MyMsg = MsgBox("Make 'BOL' and 'Tonnage' folders?", vbYesNo, CellDir)
            If MyMsg = vbYes Then
                mkdir "E:\Users\Corp Est\LM Region\PROJECTS\" & CellDir & "\BOL"
                mkdir "E:\Users\Corp Est\LM Region\PROJECTS\" & CellDir & "\Tonnage"
            End If
        End If
    Next i
    End Sub
    Last edited by RHCPgergo; 10-25-2012 at 03:11 PM. Reason: spelling

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