Hello all.
I have the below vba that creates multiple folders based on a list. now i want a vba code to save worksheet into the multiple folders based on the list.
I have attached the spreadsheet.
I have the below vba that creates multiple folders based on a list. now i want a vba code to save worksheet into the multiple folders based on the list.
Code:
Sub Saveinmultiplefolders()
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
xdir = "C:\Users\yhs0004\Desktop\Various Files\Folder VBA\" & Range("A" & i).Value
If Not fso.FolderExists(xdir) Then
fso.CreateFolder (xdir)
End If
Next
Application.ScreenUpdating = True
End Sub
I have attached the spreadsheet.
Attachments
Last edited by a moderator: