willow1985
Well-known Member
- Joined
- Jul 24, 2019
- Messages
- 929
- Office Version
- 365
- Platform
- Windows
I have the below code that will create folders based on a selected range of folder names in a column but I want to take this further and do not know where to begin.
First I need this modified that it will create folders in a directory of your choosing NOT where the spreadsheet is located.
It will make all the folder names listed in column A in the directory listed in B. Then it will make 2 Subfolders: Documents and Drawing in each primary folder and copy documents into those sub folders (or where ever it is specified to save it).
I hope I am explaining things properly and I hope someone can help me modify the below code or if anyone knows of a better one?
I am still new to this and the users who want to use this file want it to be customizable so the details are in the below sheet.
First I need this modified that it will create folders in a directory of your choosing NOT where the spreadsheet is located.
It will make all the folder names listed in column A in the directory listed in B. Then it will make 2 Subfolders: Documents and Drawing in each primary folder and copy documents into those sub folders (or where ever it is specified to save it).
I hope I am explaining things properly and I hope someone can help me modify the below code or if anyone knows of a better one?
I am still new to this and the users who want to use this file want it to be customizable so the details are in the below sheet.
VBA Code:
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
Cell Formulas | ||
---|---|---|
Range | Formula | |
E2:E14 | E2 | ="\\Usa-files\Quality\"&A2&"\"&C2 |
F2:F14 | F2 | ="\\Usa-files\Quality\"&A2&"\"&D2 |
Last edited: