+ Reply to Thread
Results 1 to 9 of 9

Sort by multiple columns with sort criteria cell dependent

  1. #1
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    807

    Sort by multiple columns with sort criteria cell dependent

    I have an array b8:k500 (excluding headings on B7:k7). I am trying to get VBA to sort it depending on what the user nominates (from dropdowns to validate entry) in cells j2:j4, based on j2 condition firest, then j3 and then j4. Obviously the dropdowns are represented in the column headings. Please can someone point me to where I might find an answer - battled all afternoon with no result.
    Last edited by BRISBANEBOB; 01-23-2014 at 11:39 PM.

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sort by multiple columns with sort criteria cell dependent

    Perhaps to take a look to advanced filter option.

    Also keep in mind that.

    Be sure that best way to describe your problem is to upload a sample workbook.

    Be sure that all sensitive data removed, showing what data you are working with, a few examples of what your expected outcome is, and how you arrived at that.

    To attach a small sample workbook.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: Sort by multiple columns with sort criteria cell dependent

    G'day mate,

    Could you post a simplified sample of what you are trying to do?

    Alternatively, this youtube video proposes a dynamic solution using formulas. I am not sure this is what you need but it might be useful.

    http://www.youtube.com/watch?v=7oPaxWdx1xQ

    -Phil

  4. #4
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    807

    Re: Sort by multiple columns with sort criteria cell dependent

    Sample attached
    Attached Files Attached Files

  5. #5
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Sort by multiple columns with sort criteria cell dependent

    Hi BRISBANEBOB,
    maybe so
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    807

    Re: Sort by multiple columns with sort criteria cell dependent

    HI Nilem

    Perfect! I was miles off track the way I was trying to do it. Thanks

  7. #7
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    807

    Re: Sort by multiple columns with sort criteria cell dependent

    HI Nilem

    Once question if I may? Where do you specify the sort range or maybe that should be how do you specify the sort range? That is where I was going wrong.

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Sort by multiple columns with sort criteria cell dependent

    Range("B7:K7").CurrentRegion is the range to sort
    x = Range("J2:J4").Value is an array of numbers of columns that are sorted.

  9. #9
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    807

    Re: Sort by multiple columns with sort criteria cell dependent

    Thank you.

+ 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. Replies: 2
    Last Post: 01-15-2014, 09:31 AM
  2. [SOLVED] Query Multiple Web Pages> Sort For Specific Criteria > Save Lists of Sort in txt files
    By Tlandress in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 01-15-2013, 12:09 AM
  3. Replies: 1
    Last Post: 08-21-2012, 03:14 PM
  4. Replies: 1
    Last Post: 12-20-2010, 06:30 PM
  5. Replies: 1
    Last Post: 10-22-2009, 05:26 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