e = Element in Array created by Filter function.
Examine the difference
Sub test()
Dim e
Application.ScreenUpdating = False
With Sheets("sheet1").Cells(1).CurrentRegion
.Parent.AutoFilterMode = False
For Each e In Filter(.Parent.[transpose(if(countif(offset(a2:a10000,,,row(1:10000)),a2:a1000)=1,a2:a1000&char(3)&e2:e10000,char(2)))], Chr(2), 0)
.AutoFilter 1, Split(e, Chr(3))(0)
.Copy Sheets("sheet2").Cells(1)
Sheets("sheet2").Copy
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & Split(e, Chr(3))(1) & ".xlsx"
ActiveWorkbook.Close
.AutoFilter: Sheets("sheet2").Cells.Clear
Next
End With
Application.ScreenUpdating = False
End Sub
Bookmarks