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
- 3346 reads

Recent comments
6 years 36 weeks ago
7 years 22 weeks ago
7 years 34 weeks ago
7 years 37 weeks ago
7 years 38 weeks ago
7 years 43 weeks ago
7 years 51 weeks ago
8 years 1 day ago
8 years 1 day ago
8 years 2 days ago