+ Reply to Thread
Results 1 to 6 of 6

Sort not working now...

  1. #1
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Sort not working now...

    I had sorting code that was working before, but not now.
    Can anyone please see if anything is wrong with this sort code?

    Please Login or Register  to view this content.
    Thanks!

    Rows are being sorted like this now:

    ColumnA

    BBB ...
    AAA ...
    BBB ...
    BBB ...

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Sort not working now...

    Where does your data start? Is there a header, and if so, what row?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: Sort not working now...

    Quote Originally Posted by shg View Post
    Where does your data start? Is there a header, and if so, what row?
    My data is inside my named range $A$20:$K$29.
    There is no header in this range.

    I just recorded a macro for sorting the range and saw a few things.
    First, the sorting was defaulting to a header, so I changed it to no header.
    Then it sorted properly. I will change my code to the following and try it again:

    'Selection.Sort Key1:=Range("A20"), Order1:=xlAscending, Header:=xlNo, _
    Last edited by ChrisXcel; 04-28-2014 at 07:46 PM.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Sort not working now...

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    Re: Sort not working now...

    Quote Originally Posted by shg View Post
    Please Login or Register  to view this content.
    Thanks very much shg, your code is the simplest (and it works), so I will go with it.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Sort not working now...

    You're welcome.

+ 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. Sort button ...not working
    By jw01 in forum Excel General
    Replies: 8
    Last Post: 07-14-2011, 11:13 AM
  2. Sort Macro not working.
    By justforthis1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2009, 08:46 PM
  3. VBA sort not working
    By beechum1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-26-2009, 11:20 PM
  4. Sort by state not working
    By manoa in forum Excel General
    Replies: 4
    Last Post: 06-18-2007, 08:30 PM
  5. Sort not working
    By STEVEB in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-07-2006, 02:12 PM

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