Results 1 to 5 of 5

Thread: Question - Sorting by specified values

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    2

    Question - Sorting by specified values

    Is it possible to set the macro to sort in a specific order, set by me?

    For instance, if I want specific words sorted not necessarily alphabetiacally, is that possible?

    For instance if I have these words:
    • Principal
    • Teacher
    • Pupil


    And I want them to sort like this:
    1. Principal
    2. Teacher
    3. Pupil


    That's not alphabetically sorted and it's not numerically sorted.

    How do I go about it?

    Here's the macro created to sort the column alphabetically:
    Code:
    Sub ConfRank()
    '
    ' ConfRank Makro
    '
    
    '
        Range("C5:AR24").Select
        Range("AR24").Activate
        Selection.Sort Key1:=Range("V5"), Order1:=xlAscending, Header:=xlGuess, _
            OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
            DataOption1:=xlSortNormal
        Range("V5:V24").Select
        ActiveWindow.Zoom = 100
    End Sub
    Any help is appreciated..

  2. #2
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: Question - Sorting by specified values

    Quote Originally Posted by JonatanRaven
    For instance if I have these words:
    • Principal
    • Teacher
    • Pupil


    And I want them to sort like this:
    1. Principal
    2. Teacher
    3. Pupil


    That's not alphabetically sorted and it's not numerically sorted.
    I think there is no difference between two list you gave. Then what sorting you want?

    Please give us more detail so that we can help you better.
    Last edited by cssriraman; May 13th, 2006 at 02:56 PM.
    CS

  3. #3
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Question - Sorting by specified values

    Jonatan, welcome to the forums

    The best way to achieve this is by using the Custom List feature in Excel.

    Goto -->>Tools-->>Options-->>Custom Lists. Click Add and enter the list in the sort order that you need, or you can import it from a range - if that range is correctly ordered.

    Then when you need to sort by that order - in the Sort dialog click on Options... and change the "First key sort order" from normal to your custom list.
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    2

    Re: Question - Sorting by specified values

    Ah..

    Thank you, that seemed to help a lot..

    Thx.

  5. #5
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: Question - Sorting by specified values

    Please resolve the thread if you get an answer
    CS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width