+ Reply to Thread
Results 1 to 15 of 15

Sort left to right rows

  1. #1
    Registered User
    Join Date
    01-17-2011
    Location
    montreal, canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Sort left to right rows

    I need to sort data in a spreadsheet from left to right in multiple rows. The data starts in G6 and ends in j46. I would like to know how to do this. I cannot program a macro so if one is needed please explain how to edit the macro to be used in other spreadsheets where the data to be sorted in rows (left to right) starts in different cells. Thanks.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sort left to right rows

    Hi msacher

    Welcome to the forum.

    Select your rows. Then Select Sort as normal, click the Options.... Button, then under Orientation select the "Left to Right" Radio Button click OK.

    You will now see Rows Top Left and the Drop-Down will have rows instead of columns listed.

    Remember to set it back to columns when you're done.

    Hope this helps.
    Last edited by Marcol; 01-18-2011 at 02:27 AM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  3. #3
    Registered User
    Join Date
    01-17-2011
    Location
    montreal, canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Sort left to right rows

    Thanks. But that is for doing it one row at a time, correct? I want to highlight everything and do it all at once. I have tried the "ctrl-Y" shortcut after doing one row but that does not work. That is why I thought I needed a macro. Sorry if I wasn't clear at first.

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sort left to right rows

    That should sort as many rows, or part thereof, as you select.

    The method can through up some unexpected results so test on dummy data until you feel comfortable with it.

  5. #5
    Registered User
    Join Date
    01-17-2011
    Location
    montreal, canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Sort left to right rows

    My problem is when I select "left to right", I have a drop-down for selecting which rows. I am unable to select them all. And if I don't select any, nothing happens. So can you talk me through what to do at this point? Thanks.

  6. #6
    Registered User
    Join Date
    01-17-2011
    Location
    montreal, canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Sort left to right rows

    Here is a screen shot of where I am. If I don't select which row (on the left button) then nothing happens. And if I select a row, it only sorts that row. From what I can tell, this is not straightforward....
    Attached Images Attached Images

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sort left to right rows

    Can you post the workbook or part thereof?

    It should clearly illustrate your problem and not contain any sensitive data.

  8. #8
    Registered User
    Join Date
    01-17-2011
    Location
    montreal, canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Sort left to right rows

    I want to sort from high to low (left to right) the values in columns H-K, treating each row independently (ie each row represents a student). I have other workbooks to do this for with many more rows than this example. I should add that I was able to sort one row in Excel 2003, and then use ctrl-y to do all the other rows in one shot. That is not working on Excel 2007 which I am presently using. Thanks.
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor jwright650's Avatar
    Join Date
    12-10-2010
    Location
    Va, USA
    MS-Off Ver
    Excel 2003, Excel 2010
    Posts
    606

    Re: Sort left to right rows

    My coding is kinda hokie but it works....see attachment that is saved in a 2003 format
    Attached Files Attached Files
    Life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.
    John Wright

  10. #10
    Registered User
    Join Date
    01-17-2011
    Location
    montreal, canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Sort left to right rows

    Thanks. Is there a simpler way to write that macro so it can be edited and adpated to other spreadsheets with more rows?

  11. #11
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Sort left to right rows

    Use a loop and don't use Selection

    Change the code to this in Johns' workbook, this will count the number of rows to sort, just change the cell refs to suit your needs.
    Please Login or Register  to view this content.
    Hope this helps
    Last edited by Marcol; 01-18-2011 at 09:14 PM.

  12. #12
    Registered User
    Join Date
    03-25-2012
    Location
    JAPAN
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Sort left to right rows

    Sub Macro8()
    '
    ' Macro8 Macro

    Range("C2:H2").Select
    Selection.Sort Key1:=Range("C2"), Order1:=xlAscending, Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlLeftToRight, _
    DataOption1:=xlSortNormal
    End Sub


    i had about 2000 rows in columns C to column H. (there are info till column P but I dont want them in the sort range)

    how can i sort automatically each row through all 2000 row

    the basic macro i recoreded it did not automatically go
    Range("C2:H2").Select
    Range("C3:H3").Select
    Range("C4:H4").Select
    .....
    .....
    .....
    Range("C2000:H2000").Select

    pls some expert help me to figure this out

    many thx in advance

  13. #13
    Registered User
    Join Date
    03-25-2012
    Location
    JAPAN
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Sort left to right rows

    ps im using excel 2003

  14. #14
    Registered User
    Join Date
    05-08-2019
    Location
    United Kingdoom
    MS-Off Ver
    2010
    Posts
    1

    Re: Sort left to right rows

    I am trying to sort multipe rows left to right but nothing work, amazing how little i know about excel or how hard it is sometimes to do "simple" stuff inexcel 2010


    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
    2 5 17 18 21 22 23 26 27 38 39 43 48 52 53 59 67 72 75 76
    2 9 16 18 25 27 30 37 41 53 60 61 63 64 66 67 68 73 76 78
    43 68 16 42 59 77 65 5 48 67 39 14 35 80 19 78 18 73 31 47
    68 36 31 35 29 2 47 66 72 15 54 58 42 61 8 48 17 45 63 50
    71 61 47 6 39 52 21 46 4 33 8 79 12 35 24 65 42 55 80 17
    51 67 31 13 23 56 2 52 50 55 54 43 72 16 59 12 44 5 27 74
    60 52 25 73 4 22 44 65 39 67 45 79 69 23 27 75 63 38 37 68

  15. #15
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,690

    Re: Sort left to right rows

    Kaipo, welcome to the forum. Please check the forum rules, especially #4, posting a question in another person's thread.
    If you think this thread has relevance to your issue, copy the url and open your own post (so people can specifically tailor their answers to your issue) and you can paste the url into your post if you feel it is relevant to your issue. Again, welcome to the forum.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1