+ Reply to Thread
Results 1 to 2 of 2

Sorting data in coloums based on another coloum - Code Continuation

  1. #1
    Forum Contributor
    Join Date
    06-25-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    179

    Sorting data in coloums based on another coloum - Code Continuation

    Hello All,
    I wanted to know how to sort a list of data in a row based on a number in the colum next to it and then by Alphabetical order.

    So for example Coloum I contains the numbers 2, 1.2 and 1.1
    I need it so that everything if I says 1.1 then the coressponding J cell is placed in a list bellow A3. This should then be repeated for all values of 1.1. Then 1.2 should go in B3 and bellow and 2 should go in C3.

    So far i've written this bit that collects and sorts data in J based on I, but im not sure how to continue it to split it up under the A,B,C coloums in the same alphabetical order.

    Code so far
    Please Login or Register  to view this content.
    Test file here to show the sort Test book1.xls
    Last edited by joshnathan; 07-16-2012 at 04:30 AM.

  2. #2
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Sorting data in coloums based on another coloum - Code Continuation

    A bit of code for you. Go to the VBA IDE (alt-F11), insert a new module, and paste in this code:

    Please Login or Register  to view this content.
    The btnSortSplit_Click procedure calls SortSplit, passing it the header range of the source data and the first cell of the destination. The SortSplit procedure first identifies and clears out any previous results in the destination, sorts the source data, the loops through the sorted source data looking for changes. As changes are found, they are copied to the destination.

    Assign the btnSortSplit_Click to a button on your sheet, and you are good to go.

+ 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