Hi im crap at VBA, but ive used a folder creator:
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
And found an old post Create a Directory with VBA explaining how to add in subfolders using:
Dim rngSubDir As Range, cell2 As Range
Dim dynPath2 As String
Set rngSubDir = Worksheets("Sheet1").Range("B2:C4") '//Range with subfolders
For Each cell In Rng
dynPath = baseBase & cell.Value
If Len(Dir(dynPath, vbDirectory)) = 0 Then
MkDir dynPath
End If
For Each cell2 In rngSubDir
dynPath2 = dynPath & cell2.Value
If Len(Dir(dynPath, vbDirectory)) = 0 Then
MkDir dynPath
End If
Next cell2
Next cell
With the explanation: If you want the same folders in every directory currently in the selection range you could place them in a separate range and For Each loop through them. By adding this and removing the for each loop in the sub.
BUT its not working for me. any idea how i can integrate/combine the two?
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
And found an old post Create a Directory with VBA explaining how to add in subfolders using:
Dim rngSubDir As Range, cell2 As Range
Dim dynPath2 As String
Set rngSubDir = Worksheets("Sheet1").Range("B2:C4") '//Range with subfolders
For Each cell In Rng
dynPath = baseBase & cell.Value
If Len(Dir(dynPath, vbDirectory)) = 0 Then
MkDir dynPath
End If
For Each cell2 In rngSubDir
dynPath2 = dynPath & cell2.Value
If Len(Dir(dynPath, vbDirectory)) = 0 Then
MkDir dynPath
End If
Next cell2
Next cell
With the explanation: If you want the same folders in every directory currently in the selection range you could place them in a separate range and For Each loop through them. By adding this and removing the for each loop in the sub.
BUT its not working for me. any idea how i can integrate/combine the two?