Custom Sort Order

  • I try to sort based upon a custom sort order, which is an array. I populated the custom sort order array from a range of cell values.

    Why can't I just call the name of the array as below?


    Each time that I run the VBA Macro, it adds another Custom List. These accumulate and I think that they cause issues. Can I delete all old custom sort lists at the start of a run?

    Why do I need to use Order:=xlAscending? Does this interfere with my use of the Custom List?

  • Would it be easier to just number the items in the SortOrderArray, find the position of each value in in my data in the SortOrderArray and write the numbers to an adjacent column, then sort the entire table based on those numbers? It wouldn't be that tedious and it would add an extra column, but I think that it would make my sort function much more robust.

  • You can get rid of these lines

    Application.DeleteCustomList ListNum:=9
     Application.AddCustomList ListArray:=Array("PUH IV", "PUH D PUH Charge", "PUH Flex Shift")

    as you already have the custom list in the code.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!