KongUK
10-13-2017, 03:58 AM
Hi
I need to parse Right function to sort order key ie
Cell values per row are PART-***X, need to sort on last 5 characters (First part of value is not just PART)
Right(PART-1234, 5) = -1234
Can I fit the Right function into the sort key when using this approach instead using an additional calculated column?
ActiveSheet.Sort.SortFields.Add Key:=Range("E9:E" & lastrow) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlTextAsNumbers
With ActiveSheet.Sort
.SetRange (MyRange)
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Thanks
I need to parse Right function to sort order key ie
Cell values per row are PART-***X, need to sort on last 5 characters (First part of value is not just PART)
Right(PART-1234, 5) = -1234
Can I fit the Right function into the sort key when using this approach instead using an additional calculated column?
ActiveSheet.Sort.SortFields.Add Key:=Range("E9:E" & lastrow) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlTextAsNumbers
With ActiveSheet.Sort
.SetRange (MyRange)
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Thanks