This should get the workbook from the second path instead of the first;
Sub copyStuff4()
Dim wbsrc As Workbook, wbdst As Workbook, fName As String, sPath As String, dPath As String, pary As Variant
sPath = "C:\Source\Master\"
dPath = "C:\Destination\"
pary = Array("1. Abcd", "2. Efgh", "3. Hij", "4. Klm", "5. Nopq", "6. Rstu", "7. Vx", "8. Wyzab", "9. Cdefghi", "10. Jkl")
For i = LBound(pary) To UBound(pary)
Set wbsrc = Workbooks.Open(sPath & pary(i) & "\" & Dir(sPath & pary(i) & "\*.xl*"))
On Error GoTo Skip:
fName = Dir(dPath & pary(i) & "\*.xl*")
Do While fName <> ""
Set wbdst = Workbooks.Open(dPath & pary(i) & "\" & fName)
wbsrc.Sheets("Dept").Copy After:=wbdst.Sheets(wbdst.Sheets.Count)
wbsrc.Sheets("Result").Copy After:=wbdst.Sheets(wbdst.Sheets.Count)
wbsrc.Close False
wbdst.Close True
Skip:
If Err.Number > 0 Then
MsgBox Err.Number & ": " & Err.Description & vbLf & "Workbook " & fName & " Not processed"
wbsrc.Close False
Err.Clear
On Error GoTo 0
End If
fName = Dir
Loop
Next
MsgBox "All Files Have Been Processed!", vbInformation, "COMPLETE"
End Sub
Bookmarks