How to quickly create folders based on cell values in Excel?
Supposing you have a list of staff names in a range of a worksheet, and now you want to create some folders for each of them in the cells to record their information. If you create the folders one by one, it will waste a lot of time. But how could you quickly create these folders? Today, I will introduce you some quick tricks:
Create folders based on cell values with VBA code
Quickly create folders based on cell values with Kutools for Excel
Create folders based on cell values with VBA code
For example, I have a range of names in a worksheet, I want to create folders for each of them, and save them to a specified path, with the VBA code, I can finish this task.
1. Put the active workbook into a specific directory which you will place the created folders into. Open the workbook and select the range of cells that you want to use.
2. Click Developer > Visual Basic, a new Microsoft Visual Basic for applications window will be displayed, click Insert > Module, and input the following code into the Module:
VBA code: create folders based on cell values
Sub MakeFolders()
Dim Rng As Range
Dim maxRows, maxCols, r, c As Integer
Set Rng = Selection
maxRows = Rng.Rows.Count
maxCols = Rng.Columns.Count
For c = 1 To maxCols
r = 1
Do While r <= maxRows
If Len(Dir(ActiveWorkbook.Path & "\" & Rng(r, c), vbDirectory)) = 0 Then
MkDir (ActiveWorkbook.Path & "\" & Rng(r, c))
On Error Resume Next
End If
r = r + 1
Loop
Next c
End Sub
3. Click button to execute the code. All the selected cells have been created to folders with their values. And the folders are placed into the path as same as the active workbook. See screenshot:
Quickly create folders based on cell values with Kutools for Excel
It is easy and convenient for you to create folders based on cell vales if you use the tool- Kutools for Excel.
Kutools for Excel, with more than 300 handy functions, makes your jobs more easier. | ||
After installing Kutools for Excel, please do as below:(Free Download Kutools for Excel Now!)
1. Select the range that you want to create folders.
2. Click Kutools Plus > Import / Export > Create Folders from Cell Contents…, see screenshot:
3. In the Create Folders from Cell Contents dialog box, click button to specify the path you want to save the folders. Seen screenshot:
4. Click OK. And a prompt box will remind you how many folders have been created. See screenshot:
5. Click OK. And all of the values in the selected range have been created folders in the specified folder.
List all file names from a folder into a sheet
to know more about this function.Here is an utility in Kutools for Excel – Filename List can list all file names of a folder in a sheet, if you are interested in it, please go on reading.
After installing Kutools for Excel, please do as below:(Free Download Kutools for Excel Now!)
1. Click Kutools Plus > Import/Export > Filename List.
2. In the Filename List dialog, select a folder you want to list its files, the check All files or Specify option as you need in Files type section.
img src="//cdn.extendoffice.com/images/stories/doc-excel/create-folders/doc-create-folder-6.png" alt="doc create folder 6" />
3. Click Ok, a new sheet is created with all file names and some relative information.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!












