Hi!
I am trying to code of making a folders and sub-folders from an Excel.
Yet I could not figure out how to come up with the result as illustrated below
RESULT:
Folder Sub-folders
6. June 6-Jun_Morning
6-Jun_Lunch
6-Jun_Evening
I have the code below, it works somehow but only the sub-folders 6-Jun_Morning are populated inside the Folder 6.Jun
the others are outside from Folder 6. Jun.
Sub createfolders()
Dim fpath As String
Dim i, xc As Integer
On Error Resume Next
For i = 1 To ActiveSheet.UsedRange.Rows.Count
xc = Range("XFD" & i).End(xlToLeft).Column
If xc = 1 Then
fpath = Cells(i, xc).Value
Else
fpath = Cells(Cells(i, xc).End(xlUp).Row, xc - 1).Value & "/" & Cells(i, xc).Value
End If
MkDir ("C:\Users\HP\Desktop\TP MASTER\Back Up\" & fpath)
If Error.Number <> 0 Then
Err.Clear
End If
Next
End Sub
------
I have attached my Excel for a reference.
Please any help is really appreciated.
Regards,
Rev12
Bookmarks