Joshi
The code below will create the sheets and do the filtering in the current workbook.
Sub aaa()
Sheets.Add before:=Sheets(1)
ActiveSheet.Name = "Working"
Sheets("Master").Activate
Set datarng = Range("A2:T" & Cells(Rows.Count, 1).End(xlUp).Row)
Range("T2:T" & Cells(Rows.Count, "T").End(xlUp).Row).AdvancedFilter Action:=xlFilterCopy, copytorange:=Sheets("Working").Range("A1"), unique:=xlYes
With Sheets("Working")
.Range("B1").Value = .Range("A1").Value
For Each ce In .Range("A2", .Range("A2").End(xlDown))
.Range("B2").Value = ce.Value
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = ce.Value
ActiveSheet.Range("A2:T2").Value = Sheets("Master").Range("A2:T2").Value
datarng.AdvancedFilter Action:=xlFilterCopy, copytorange:=Range("A2:T2"), criteriarange:=.Range("B1:B2")
Next ce
End With
Application.DisplayAlerts = False
Sheets("Working").Delete
Application.DisplayAlerts = True
End Sub
rylo
Bookmarks