XLA routines: EE_CustomSort
EE_CustomSort sorts data using Excel 2007 and above
Sub EE_CustomSort(rngTable As range, strFldName As String, strCustomSortOrder As String) Dim intCol As Integer 'http://excelexperts.com/xla-routines-eeCustomSort for updates on this sub routine intCol = Application.WorksheetFunction.Match(strFldName, rngTable.Rows(1), 0) With rngTable.Parent.Sort .SortFields.Clear .SortFields.Add Key:=Intersect(rngTable.Columns(intCol), rngTable.Columns(intCol).Offset(1)), _ SortOn:=xlSortOnValues, Order:=xlAscending, CustomOrder:= _ CStr(strCustomSortOrder), DataOption:=xlSortNormal .SetRange rngTable .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With End Sub
»
- Nick's blog
- Login or register to post comments
- 2897 reads
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago