hkydad
Board Regular
- Joined
- May 16, 2013
- Messages
- 66
- Office Version
- 365
- Platform
- Windows
I have a macro that when run, creates a set of folders in a directory based on information in a spreadhseet. Now what I want to do is create sub-folders based on another column within the same spreadhseet. Here are exapmples of the code and the spreadhseet.
Sub MakeFolders_485BPOS()
Dim xdir As String
Dim fso
Dim lstrow As Long
Dim i As Long
Set fso = CreateObject("Scripting.FileSystemObject")
lstrow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = 1 To lstrow
xdir = "Y:\Filing_Types\485BPOS\" & Range("A" & i).Value
If Not fso.FolderExists(xdir) Then
fso.CreateFolder (xdir)
End If
Next
Application.ScreenUpdating = True
End Sub
Now once these folders are created, I want to create several subfolders under each of the folders created above. How do I do this?
Sub MakeFolders_485BPOS()
Dim xdir As String
Dim fso
Dim lstrow As Long
Dim i As Long
Set fso = CreateObject("Scripting.FileSystemObject")
lstrow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = 1 To lstrow
xdir = "Y:\Filing_Types\485BPOS\" & Range("A" & i).Value
If Not fso.FolderExists(xdir) Then
fso.CreateFolder (xdir)
End If
Next
Application.ScreenUpdating = True
End Sub
Now once these folders are created, I want to create several subfolders under each of the folders created above. How do I do this?