Option Explicit
Sub CreateDirs()
Dim R As Range
Dim RootFolder As String
Dim sFolderPath As String
sFolderPath = "C:\Users\My\Desktop\" & Range("A1").Value '<<< Edit path as required
If Right(sFolderPath, 1) <> "\" Then
sFolderPath = sFolderPath & "\"
End If
If Dir(sFolderPath, vbDirectory) <> vbNullString Then
MsgBox "Sorry ... that folder already exists. " & vbCrLf & _
"Please choose another folder.", vbCritical, "File Folder Error !"
Exit Sub
Else
MkDir "C:\Users\My\Desktop\" & Range("A1").Value '<<< Edit path as required
End If
RootFolder = "C:\Users\My\Desktop\" & Range("A1").Value '<<< Edit path as required
For Each R In Range("A2:A13")
If Len(R.Text) > 0 Then
On Error Resume Next
MkDir RootFolder & "\" & R.Text
On Error GoTo 0
End If
Next R
CreateSheetsFromAList
End Sub
Sub CreateSheetsFromAList()
Dim i As Integer
Dim MyCell As Range, MyRange As Range
i = 1
For i = 1 To 31 'Each MyCell In MyRange
Sheets.Add After:=Sheets(Sheets.Count) 'creates a new worksheet
Sheets(Sheets.Count).Name = i 'renames the new worksheet
Next
Application.DisplayAlerts = False
Sheets("Sheet1").Delete
Sheets("Sheet2").Delete
Sheets("Sheet3").Delete
Application.DisplayAlerts = True
Sheets("1").Select
SaveBookAs
End Sub
Sub SaveBookAs()
Dim Path As String
Dim filename1 As String
Dim myvalue As String
myvalue = InputBox("Enter 4 Digit Year (Folder Name)", "Which Year ?", "")
Path = "C:\Users\My\Desktop\" & myvalue & "\" '<<< Edit path as required
filename1 = "Days Of Month"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=Path & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:=Path & "1\" & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:=Path & "2\" & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:=Path & "3\" & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:=Path & "4\" & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:=Path & "5\" & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:=Path & "6\" & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:=Path & "7\" & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:=Path & "8\" & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:=Path & "9\" & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:=Path & "10\" & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:=Path & "11\" & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:=Path & "12\" & filename1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Dim aFile As String
aFile = "C:\Users\My\Desktop\" & myvalue & "\Days Of Month.xlsx" '<<< Edit path as required
If Len(Dir$(aFile)) > 0 Then
Kill aFile
End If
Application.DisplayAlerts = True
MsgBox "All Actions Completed ! ", vbInformation, "Folder Creation ..."
Application.Quit
ActiveWorkbook.Close False
End Sub