Below is the list of names, and the macro code to sort and output the data. The macro runs separately for each name. I would like it to reuse the main body of the code, with the macro choosing each name, in turn, from the list
List of names:
Manny Joe Tom Mike
Sort and output code for Manny:
Sheets("Manny").Select
Range("A2:J1000").Select
Selection.ClearContents
Sheets("Master list").Select
Range("A1:J1000").Select
ActiveSheet.Range("$A1:J351").AutoFilter Field:=10, Criteria1:= _
"Manny"
Selection.Copy
Sheets("Manny").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Columns("H:H").Select
ActiveWorkbook.Worksheets("Manny").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Manny").Sort.SortFields.Add Key:=Range("H1"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Manny").Sort
.SetRange Range("A2:J351")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Columns("A:A").EntireColumn.AutoFit
Columns("E:E").EntireColumn.AutoFit
Sheets("Master list").Select
ActiveSheet.Range("$A1:J350").AutoFilter Field:=10