Hi
See your updated workbook attached.
Dion
Sub SortData()
Dim ws As Worksheet
Dim varRow As Long
Dim varFirstRow As Long
Dim varLastRow As Long
Dim rng As Range
Set ws = ThisWorkbook.Sheets("Sheet1")
varLastRow = ws.Range("A60000").End(xlUp).Row
'Find varFirstRow
For varRow = 2 To varLastRow
If ws.Cells(varRow, 1).Value = "Template" Then
varFirstRow = varRow + 1
End If
Next varRow
With ws.Sort
.SortFields.Clear
.SortFields.Add Key:=Range(Cells(varFirstRow, 1), Cells(varLastRow, 1)) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.SetRange Range(Cells(varFirstRow, 1), Cells(varLastRow, 4))
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Bookmarks