+ Reply to Thread
Results 1 to 5 of 5

VBA Not Sorting Properly

  1. #1
    Forum Contributor
    Join Date
    02-18-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    197

    VBA Not Sorting Properly

    I'm using the following code to create subsections and subtotals based on the value in column A. But for some reason it isn't sorting properly with this data set (see attached sample file). It works about 80% of the time, but it has trouble when two sections in a sequence have only one value. It'll lump the top one with the section above it.


    Please Login or Register  to view this content.

    Any ideas?


    Thanks!!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA Not Sorting Properly

    Looks the one I wrote in somewhere
    1) Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    2) Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    02-18-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    197

    Re: VBA Not Sorting Properly

    It's still not sorting quite right. For instance, this set of values:

    1306050
    1306050
    1306872
    1306876
    1306903
    1306903
    1306903

    Should be split up like this:

    1306050
    1306050


    1306872


    1306876


    1306903
    1306903
    1306903

    But it's actually coming out like this:

    1306050
    1306050


    1306872




    1306876
    1306903
    1306903
    1306903

    It's inserting the correct number of rows, but it isn't separating the numbers properly.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA Not Sorting Properly

    Are you talking about same file?
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    02-18-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2013
    Posts
    197

    Re: VBA Not Sorting Properly

    That worked. I just had one number off in the formula on mine.

    Thanks for your help, Jindon!

+ 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. Pivot table not sorting properly
    By Dast in forum Excel Charting & Pivots
    Replies: 13
    Last Post: 06-10-2016, 06:43 PM
  2. Sorting A-Z not working properly
    By AKM1 in forum Excel General
    Replies: 1
    Last Post: 09-03-2013, 10:29 AM
  3. [SOLVED] Excel music program not sorting properly
    By beltwaybob in forum Excel General
    Replies: 5
    Last Post: 01-27-2013, 07:57 PM
  4. Report not sorting properly
    By nzkazza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2012, 10:46 PM
  5. sorting is not properly done on folders
    By joe41 in forum Word Formatting & General
    Replies: 1
    Last Post: 03-20-2009, 07:40 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