Creating multiple folders at once

craigg3

Board Regular
Joined
Dec 23, 2002
Messages
161
Office Version
  1. 2013
Platform
  1. Windows
I have a workbook that allows users to enter a folder name in cell C15 and then when they click a button the folder will be created in the same path as which the workbook resides. Right now if a user is using the workbook that is located at "C:\Documents\" and the user wants to create a folder called "Ford", then the macro would create the "Ford" folder as C:\Documents\Ford\".

Some users are putting multiple folder locations in cell C15 such as "Ford\Interior\Carpet" which isn't working because they are trying to enter multiple paths that do not exist. Is there a way to create the full path the way the user has entered it if that path doesn't currently exist? Im using the following macro to create a single folder within the path that the workbook resides:

Dim thisWb As Workbook
Set thisWb = ActiveWorkbook

FDN = Sheets("Settings").Range("C15")
NewFolder = thisWb.Path & "\" & FDN

If Dir(NewFolder, vbDirectory) = "" Then
MkDir NewFolder
End IF
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top