title: EXCEL VBA - create directories and folders if they are not already there
body: <p>I have a list of folder locations in column A that define the directory hierarchy I am trying to create (e.g. "C:\topFolder\nextFolder\lastFolder\). The code runs with no errors, but no folders are created. What am I doing wrong here?</p>
  
  <pre><code>Sub newDestination()
      Dim Path As Variant
      Dim folderLevel As Variant
  
      For Each Path In Sheet11.Range("A:A")
          For Each folderLevel In Split(Path.Value, "\")
              folderLevel = folderLevel &amp; "\"
              If Len(Dir(folderLevel, vbDirectory)) = 0 Then
                  MkDir folderLevel
              End If
          Next folderLevel
      Next Path
  
  End Sub
  </code></pre>