Sub CreateFolders()
Dim LastRow As Long
Dim MainPath As String
Dim R As Long
Dim StartRow As Long
Dim Wks As Worksheet
MainPath = "G:\AWARDS\_Awards Filing Closet\"
StartRow = 1208
Set Wks = Worksheets("Sheet1")
With Wks
LastRow = .Cells(Rows.Count, "D").End(xlUp).Row
LastRow = IIf(LastRow < StartRow, StartRow, LastRow)
End With
For R = StartRow To LastRow
MkDir MainPath & Wks.Cells(R, "D")
MkDir MainPath & Wks.Cells(R, "D") & "\Correspondance"
MkDir MainPath & Wks.Cells(R, "D") & "\Establishment"
MkDir MainPath & Wks.Cells(R, "D") & "\Financials"
Next R
If (Wks.Cells(R, "E") = 1) Then
MkDir MainPath & Wks.Cells(R, "D") & "\_General Correspondance"
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "E")
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "E") & "\Unique Correspondance"
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "E") & "\Establishment"
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "E") & "\Financials"
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "F")
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "F") & "\Unique Correspondance"
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "F") & "\Establishment"
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "F") & "\Financials"
If (Wks.Cells(R, "G") = 1) Then
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "G")
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "G") & "\Unique Correspondance"
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "G") & "\Establishment"
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "G") & "\Financials"
If (Wks.Cells(R, "H") = 1) Then
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "H")
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "H") & "\Unique Correspondance"
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "H") & "\Establishment"
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "H") & "\Financials"
If (Wks.Cells(R, "I") = 1) Then
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "I")
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "I") & "\Unique Correspondance"
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "I") & "\Establishment"
MkDir MainPath & Wks.Cells(R, "D") & "\" & Wks.Cells(R, "I") & "\Financials"
End Sub
I need help especially with the If statements.
Bookmarks