ChrisCione
Board Regular
- Joined
- Aug 27, 2008
- Messages
- 92
- Office Version
- 365
- Platform
- Windows
As the subject line reads, I am receiving an error when attempting to create multiple folders on a network drive from a list in Excel using the module below. I did this last week, and it worked perfectly (created over 3000 folders in a split second). Today I replicated the action, with a different list, to no avail. Disclaimer: I didn't create the module, nor would I even know how to do so. I found the instructions to do this on a blog at Create folders from a list in Excel.
I tried placing the activeworkbook.path name in the module below and am receiving different errors. Any help is greatly appreciated.
Module:
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
EDIT:
Clicking debug highlights this line:
MkDir (ActiveWorkbook.Path & "\" & Rng(r, c))
I tried placing the activeworkbook.path name in the module below and am receiving different errors. Any help is greatly appreciated.
Module:
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
EDIT:
Clicking debug highlights this line:
MkDir (ActiveWorkbook.Path & "\" & Rng(r, c))
Last edited by a moderator: