You could use this macro I tested on your 'result' sheet:
SSub Macro1()
Dim columnsToSort As String
Dim firstCol As String, colForSort As String
Dim lastRow As Long, lastCol As String
Dim startRow As Long, endRow As Long
Dim r As Integer
'parameter to set
columnsToSort = "d:m"
colForSort = "f"
firstCol = Split(columnsToSort, ":")(0)
lastCol = Split(columnsToSort, ":")(1)
With ThisWorkbook.ActiveSheet
lastRow = .Cells.Find("*", SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
For r = 5 To lastRow + 1
If IsNumeric(.Cells(r, "e")) Then
If startRow = 0 Then
startRow = r
End If
ElseIf startRow > 0 Then
endRow = r - 1
'sort data
If endRow > startRow Then
.Range(firstCol & startRow & ":" & lastCol & endRow).Sort _
Key1:=.Range(colForSort & startRow), Order1:=xlAscending, _
Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
End If
startRow = 0
End If
Next r
End With
End Sub
Regards,
Antonio
Bookmarks