+ Reply to Thread
Results 1 to 3 of 3

Sorting issue in Excel VBA

  1. #1
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    100

    Sorting issue in Excel VBA

    My spreadsheet has two sheets one called Database and the other Cutlist. I use Database to enter information and when I click on Create Cutlist (button) a sorted table is created in Cutlist.
    Everything works well, except there is a sorting issue.

    It should sort by size (lowest to highest) and length (highest to lowest).

    Sorting should look like this…

    Size
    2x4
    2x6
    2x8
    2x10
    2x12

    Length
    ##’-## ##/##”
    down to
    #/#”

    Very simple, but the sorting is off when it comes to numbers greater than 9 for size and digits greater than 1 for length... (See attachment)
    Thanks for your help!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Sorting issue in Excel VBA

    Hi

    It looks like you are sorting using column F.

    This will never do what you want. Because the x in 2x10 makes your data alpha numeric rather than numeric. in which case 2x10 is smaller than 2x4.

    Split column F into two columns then sort by the number before x and then by number after x.

    Try inserting this routine into your code.

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 01-17-2014 at 10:59 AM.

  3. #3
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    100

    Re: Sorting issue in Excel VBA

    Thanks a lot!

+ 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. Sorting Excel sheet issue
    By jeff061768 in forum Excel General
    Replies: 7
    Last Post: 03-04-2013, 03:08 PM
  2. Excel sorting issue
    By ATEXPN in forum Excel General
    Replies: 7
    Last Post: 08-10-2011, 12:41 PM
  3. Excel Sorting Issue
    By Krist in forum Excel General
    Replies: 1
    Last Post: 08-18-2010, 01:38 PM
  4. Excel sorting Issue
    By Jzfromltown in forum Excel General
    Replies: 3
    Last Post: 12-08-2006, 08:46 AM
  5. [SOLVED] An issue when sorting in excel PivotTable
    By Microlong in forum Excel General
    Replies: 0
    Last Post: 05-10-2005, 05: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