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
- 2993 reads
Recent comments
5 years 50 weeks ago
6 years 36 weeks ago
6 years 47 weeks ago
6 years 50 weeks ago
6 years 51 weeks ago
7 years 5 weeks ago
7 years 13 weeks ago
7 years 13 weeks ago
7 years 13 weeks ago
7 years 13 weeks ago