Did you try sorting, then data|subtotals, then copy|paste the visible cells?
If that worked, you could record a macro when you did it for real.
I did that and then modified my recorded macro to get this:
Option Explicit
Sub testme01()
Dim newWks As Worksheet
Dim curWks As Worksheet
Dim FirstRow As Long
Dim LastRow As Long
Dim myRng As Range
Set curWks = Worksheets("sheet1")
If curWks.Parent.Saved = False Then
MsgBox "Please save your workbook. " _
& "This will destroy the original sort sequence"
Exit Sub
End If
Application.ScreenUpdating = False
Set newWks = Workbooks.Add(1).Worksheets(1) 'worksheet in a new workbook
With curWks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
Set myRng = .Range(.Cells(FirstRow, "A"), .Cells(LastRow, "P"))
Application.StatusBar = "Doing the sort: " & Now
myRng.Sort Key1:=.Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Application.StatusBar = "Doing the subtotal: " & Now
myRng.Subtotal GroupBy:=1, Function:=xlAverage, TotalList:=Array(16), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
.Outline.ShowLevels RowLevels:=2
Application.StatusBar = "Copying the averages: " & Now
myRng.Cells.SpecialCells(xlCellTypeVisible).Copy _
Destination:=newWks.Range("A1")
End With
With newWks
Application.StatusBar = "Formatting the summaries: " & Now
.Range("b

").EntireColumn.Delete
.Cells.RemoveSubtotal
With .Range("a:a")
.Replace What:=" Average", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
.Font.Bold = False
End With
Set myRng = .UsedRange 'try to reset last cell
End With
With Application
.ScreenUpdating = True
.StatusBar = False
End With
MsgBox "Please close your original workbook without saving." & vbLf _
& "The original sort sequence was altered"
End Sub
I assumed that you had headers in row 1 and the last row with data had something
in column A.