ChrisCione
09-28-2022, 08:16 AM
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 (https://www.iltanet.org/blogs/amy-bowser-rollins1/2021/02/09/litigation-support-tool-tip-create-folders-from-a).
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
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