Excel

Folder Creation

Ease of Use

Easy

Version tested with

2003, 2007 

Submitted by:

anupamtiwari

Description:

This will create folder with the desired name at any desired location in your PC. 

Discussion:

If you need to create so many folders on daily basis, you can use this code in excel VBA editor and use it to create folders anywhere instantly. 

Code:

instructions for use

			

Sub B_Make_Folders() Dim fname As String Dim dirname As String Dim team_members() As Variant 'to enter the folder name reference dirname = Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("C2").Value 'Reference to folder path team_members() = Array(Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A2").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A3").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A4").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A5").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A6").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A7").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A8").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A9").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A10").Value, _ Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A11").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A12").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A13").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A14").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A15").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A16").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A17").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A18").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A19").Value, Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("A20").Value) For i = 0 To Workbooks("folder_macro.xls").Worksheets("Sheet1").Range("B2").Value MkDir (dirname + "\" + team_members(i)) Next MsgBox "Folders created...", vbInformation, "Make Folders" End Sub

How to use:

  1. Open the attachment and enable macros.
 

Test the code:

  1. First Enter the folder names in A column from A2 cell and downwards... Now enter the total number of names minus one in cell B2 and finally enter the path where to create folders in Cell C2. now run the macro, your folders are ready.... currently the code will work to creates up to 20 folders at a time. you can increase the number by a little amendment in coding. thanks
 

Sample File:

folder_macro.zip 90.43KB 

Approved by Jacob Hilderbrand


This entry has been viewed 249 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express