title: Run macro that sorts and outputs data for several sheets from master worksheet
body: <p>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</p>
  <p>List of names:</p>
  <p>Manny
  Joe
  Tom
  Mike</p>
  <p>Sort and output code for Manny:</p>
  <pre><code>Sheets(&quot;Manny&quot;).Select
  Range(&quot;A2:J1000&quot;).Select
  Selection.ClearContents
  Sheets(&quot;Master list&quot;).Select
  Range(&quot;A1:J1000&quot;).Select
  ActiveSheet.Range(&quot;$A1:J351&quot;).AutoFilter Field:=10, Criteria1:= _
          &quot;Manny&quot;
  Selection.Copy
  Sheets(&quot;Manny&quot;).Select
  Range(&quot;A1&quot;).Select
  Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
          :=False, Transpose:=False
  Columns(&quot;H:H&quot;).Select
  ActiveWorkbook.Worksheets(&quot;Manny&quot;).Sort.SortFields.Clear
  ActiveWorkbook.Worksheets(&quot;Manny&quot;).Sort.SortFields.Add Key:=Range(&quot;H1&quot;), _
          SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
  With ActiveWorkbook.Worksheets(&quot;Manny&quot;).Sort
      .SetRange Range(&quot;A2:J351&quot;)
      .Header = xlNo
      .MatchCase = False
      .Orientation = xlTopToBottom
      .SortMethod = xlPinYin
      .Apply
  End With
  Columns(&quot;A:A&quot;).EntireColumn.AutoFit
  Columns(&quot;E:E&quot;).EntireColumn.AutoFit
  Sheets(&quot;Master list&quot;).Select
  ActiveSheet.Range(&quot;$A1:J350&quot;).AutoFilter Field:=10
  </code></pre>