Hi all,
I have following code which works fine to create folder.
I want to include columns A, B, C as name of the file from Range A2 down and if folder is already created then it will not duplicate it.
I am planning to incorporate this code while file is opened or assign it to userform submit button
Need some help please.
Sub MakeFolders()
Dim xdir As String
Dim fso
Dim lstrow As Long
Dim i As Long
Set fso = CreateObject("Scripting.FileSystemObject")
lstrow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = 1 To lstrow
'change the path on the next line where you want to create the folders
xdir = "C:\Foldertrial\" & Range("B" & i).Value
'want to include values from column B & C as well
If Not fso.FolderExists(xdir) Then
fso.CreateFolder (xdir)
End If
Next
Application.ScreenUpdating = True
End Sub
many thanks
Kind regards
Bookmarks