+ Reply to Thread
Results 1 to 7 of 7

Sort Specific Rows & Columns In An Array

  1. #1
    Forum Contributor
    Join Date
    10-29-2019
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    156

    Sort Specific Rows & Columns In An Array

    Hi, I know how to sort tables using sort, but cant figure out how to sort rows & columns using an array.

    Basically I had an outerloop which held the start & end range of a column, ie c1 to c3, then an innerloop which cycled through the entire row using the starting points from the outerloop. So sort from c1 to c3, then sort d1 to d3, e1 to e3 etc.,

    The outerloop then switched to the next set of starting points ie c7 to c12 & the innerloop sorts all the rows as above.


    LabelPosition contains the starting point, & LoopCount contains the end point, just add the two for the total range. ie 3+3=6

    ie.,
    LabelPosition(8) = 3
    LoopCount(8) = 3

    Would equal start at c3 & end at d6. 3 +3 = 6.

    I've copied the entire table to an array, but cant figure out how to sort each row & column in the array using the starting point LabelPosition & ending point in LoopCount.

    Many Thanks.,

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sort Specific Rows & Columns In An Array

    NON VBA solution.

    A3 =IF(B2="",A2+1,A2) and drag down.

    After that sort the data with the sort function, using column A.

    See the atttached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Contributor
    Join Date
    10-29-2019
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    156

    Re: Sort Specific Rows & Columns In An Array

    Thanks, but i need a vba solution, hence why i posted in the vba section...

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sort Specific Rows & Columns In An Array

    Then record the given solution.

    Then you have the VBA solution.

  5. #5
    Forum Contributor
    Join Date
    10-29-2019
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    156

    Re: Sort Specific Rows & Columns In An Array

    I need to sort using arrays, if you read the actual code i posted youd realise this ...

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Sort Specific Rows & Columns In An Array

    I'm not sure what you want, maybe try this.

    Please Login or Register  to view this content.

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

    Re: Sort Specific Rows & Columns In An Array

    Your code is just placing C3:E7 to Ke:M7.
    If you show us the result that you want, it will be clearer...

+ 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. Adding specific Rows and columns to an array
    By LewisMCT in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 06-08-2018, 11:58 AM
  2. Replies: 8
    Last Post: 09-20-2017, 02:09 AM
  3. [SOLVED] Sort 2D Array by one or two columns
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-07-2017, 05:45 AM
  4. [SOLVED] sort an array wrt two columns one ascending and the other descending
    By mehmetics in forum Excel General
    Replies: 6
    Last Post: 10-25-2014, 07:49 AM
  5. [SOLVED] Vba help to sort rows in array
    By markharris2004 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-05-2014, 01:28 PM
  6. Sort Out Specific Data from an Array and Re-Format
    By Leathermyth in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-09-2013, 01:17 AM
  7. UDF to sort array with multiple columns
    By flygis in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-02-2006, 01:10 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