I just posted this for someone else with a very similar issue. There's probably another way to do what you're asking but this will basically merge all sheets to one and then sort Descending by column G. You'd then just have to delete everything else that you don't want which I'm sure there's a way to add to the macro.
Sub MergeSheets()
'''''''''''''''''''''''''''''''''''''''''''''''''
'Copy data from all Worksheets to a new Worksheet
'''''''''''''''''''''''''''''''''''''''''''''''''
Dim intI, intSheetsCount As Integer
Dim blnFirstCopyComplete As Boolean
Dim NewSheet As Worksheet
Dim rngRange As Range
Dim lngLastRow
'Create a new Worksheet and move it before all Worksheets
Set NewSheet = ActiveWorkbook.Worksheets.Add(Before:=Worksheets(1))
'Get the number of Worksheets
intSheetsCount = ActiveWorkbook.Worksheets.Count
'Excluding the new Worksheet, copy all other Worksheets
'one by one
For intI = 2 To intSheetsCount
'This is the Range that will be copied to the new Worksheet
With ActiveWorkbook.Worksheets(intI)
Set rngRange = .Range(.Cells(1, 1), _
.Cells.SpecialCells(xlCellTypeLastCell))
End With
With NewSheet
'If this is the first paste, do it on the first row
If Not blnFirstCopyComplete Then
rngRange.Copy Destination:=.Cells(1, 1)
blnFirstCopyComplete = True
'Else, first find the cell where the copied range will be
'pasted and proceed with the paste
Else
'This is last row of the so far created new Worksheet data
lngLastRow = .Range(.Cells(1, 1), _
.Cells.SpecialCells(xlCellTypeLastCell)).Rows.Count
'Do the paste on the next row
rngRange.Copy Destination:=.Cells(lngLastRow + 1, 1)
End If
End With
Next 'intI
ActiveSheet.Name = "Summary"
Worksheets("Summary").Columns("a:i").AutoFit
Cells.Select
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Summary").Sort.SortFields.Add Key:=Range("g2:g500000") _
, SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Summary").Sort
.SetRange Range("A1:i500000")
.HEADER = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Bookmarks