Hello,
I have a data set with 4 columns. I need to copy all data for each sales rep to a new workbook and save the file in a network location. I have the code to do this for one rep, but my actual file has about 50 reps. I'm having trouble looping through the filter criteria and creating new workbook names for each of the reps. Here is the code I have so far:
I have also attached the file. Any help is greatly appreciated. Thanks.
Sub TEST()
'
' TEST Macro
'
Dim wb As Workbook
Dim ws As Worksheet
Set ws = ActiveSheet
Set wb = Workbooks.Add
'
ActiveSheet.Range("A:D").AutoFilter Field:=1, Criteria1:="john"
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets.Add After:=Sheets(Sheets.Count)
Range("A1").Select
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.Copy before:=wb.Sheets(1)
wb.SaveAs "file location"
End Sub
Bookmarks