+ Reply to Thread
Results 1 to 5 of 5

Sorting variable range left to right

  1. #1
    Registered User
    Join Date
    11-10-2011
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    28

    Sorting variable range left to right

    Hello there,

    I have recorded the following code that sorts from left to right. How do you make the hard coded ranges ("A1:EX1") (columns) and ("A1:EX1193") (rows) variable?

    Please Login or Register  to view this content.
    Regards,
    shinobi

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Sorting variable range left to right

    Great question. In what way do you want to make them variable? Specify in inputbox? Until the last used row and the last used column?

  3. #3
    Registered User
    Join Date
    11-10-2011
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Sorting variable range left to right

    Hi stnkynts,

    Until the last used row and the last used column.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Sorting variable range left to right

    There are many variations to obtain the last used row and the last used column. I will show you the two more common ways, one for last row, and the other for last column.

    Please Login or Register  to view this content.
    With that in mind you should be able modify the 2 lines in your code accordingly

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-10-2011
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Sorting variable range left to right

    Thanks for the tips stnkynts. I should be able to do it now. Sort left to right seems a bit more tricky than top to bottom.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to use custom sort while sorting left to right for entire dynamic used range
    By herbie226 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-05-2012, 11:58 PM
  2. Object variable or With block variable not set Error during sorting program
    By BlahBlahBlahBlahBlah in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-17-2012, 07:57 AM
  3. sorting changes the value of range-variable
    By HarryKlein in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2012, 06:55 AM
  4. Sorting from Right to Left
    By mcpete89 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 02-04-2009, 12:56 PM
  5. Sorting from right to left
    By Rocky in forum Excel General
    Replies: 5
    Last Post: 01-15-2005, 11:06 AM

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