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
- 2925 reads
Recent comments
5 years 41 weeks ago
6 years 27 weeks ago
6 years 39 weeks ago
6 years 42 weeks ago
6 years 43 weeks ago
6 years 48 weeks ago
7 years 4 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago