jassybun
Member
The code below creates folders in the right place, however, I also need to add a few more steps and I am not sure how to go about it.
Based off the excel sheet, a folder needs to be created and sorted into the month folder indicated in the name in the cell value in Column R: Lastname Firstname m.d.yyyy Location.
For example:
"Jones Samantha 1.2.2019 Chicago" is the text in the R column should create a folder in the already made January folder if it doesn't already exist.
There is one exception though: if Column J indicates any of two specific words, as an example: "ReviewItem1" or "ReviewItem2", then it instead goes into a folder named "Review", and then into the correct month folder.
If possible I would like to know what new folders were created that did not already exist in a separate excel worksheet.
So the folders looks like:
Review
January
February
etc.
inside the Review folder:
January
February
etc.

Based off the excel sheet, a folder needs to be created and sorted into the month folder indicated in the name in the cell value in Column R: Lastname Firstname m.d.yyyy Location.
For example:
"Jones Samantha 1.2.2019 Chicago" is the text in the R column should create a folder in the already made January folder if it doesn't already exist.
There is one exception though: if Column J indicates any of two specific words, as an example: "ReviewItem1" or "ReviewItem2", then it instead goes into a folder named "Review", and then into the correct month folder.
If possible I would like to know what new folders were created that did not already exist in a separate excel worksheet.
So the folders looks like:
Review
January
February
etc.
inside the Review folder:
January
February
etc.

Code:
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
Last edited: