Creating multiple folders at once

craigg3

Board Regular
Joined
Dec 23, 2002
Messages
147
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
 

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Watch MrExcel Video

Forum statistics

Threads
1,118,207
Messages
5,570,907
Members
412,347
Latest member
thanhlam1509
Top