+ Reply to Thread
Results 1 to 6 of 6

VBA to 2-step sort multiple columns

  1. #1
    Registered User
    Join Date
    08-12-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    8

    VBA to 2-step sort multiple columns

    Link to cross-post:
    http://chandoo.org/forum/threads/vba...7/#post-203641
    https://www.mrexcel.com/forum/excel-...ml#post4814278

    I have an Excel spreadsheet that I need to sort 3 columns and varying rows (see below). What I would like is VBA code to sort all columns and rows through item 'P' by Quantity (largest to smallest). Then I need to sort all 3 columns a second time by Sort Order (smallest to largest) neglecting the items with zero quantities. The number of items will always be the same so the first sort range will always be the same.

    Here is a link to a spreadsheet similar to the one I will be using: https://app.box.com/s/zxvg9acycxrqv067vfc8kct4rroww6qp

    I tried to record a macro for this but it only works for this specific example (Items may not always have quantities and/or the quantities will change value so the second sort range (rows) will change). Here is what the macro recorded:

    Please Login or Register  to view this content.
    Can someone provide help? Thanks!
    Last edited by jebersohl; 04-30-2017 at 10:31 AM. Reason: Cross-post update & sample excel doc provided

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: VBA to 2-step sort multiple columns

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

  3. #3
    Registered User
    Join Date
    08-12-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    8

    Re: VBA to 2-step sort multiple columns

    Marc - cross-post noted. thanks

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

    Re: VBA to 2-step sort multiple columns

    Try
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-12-2014
    Location
    USA
    MS-Off Ver
    365
    Posts
    8

    Re: VBA to 2-step sort multiple columns

    Jindon, I apologize for not responding. I overlooked the notification of your response in my email. I did try your code but for some reason it hung up here: "M = ary(Int((LB + UB) / 2), ref)"

    Please see this link for a (close) solution to my request. I do not need further assistance: http://chandoo.org/forum/threads/vba...7/#post-203740

    In the end, I used the code provided in the link and manipulated it for my use.

    Thank you for your time and effort.

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

    Re: VBA to 2-step sort multiple columns

    So you are doing completely wrong.
    Attached Files Attached Files

+ 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. Using a VBA to sort Multiple Columns
    By BT3 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-07-2016, 03:30 PM
  2. [SOLVED] Sort by multiple columns with sort criteria cell dependent
    By BRISBANEBOB in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-24-2014, 02:22 AM
  3. 2-step transpose and sort by unique id
    By stp79 in forum Excel General
    Replies: 2
    Last Post: 08-13-2012, 10:59 PM
  4. Assign number based on sort order (Step Ladder points)
    By benjya in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-21-2012, 01:24 AM
  5. Sort multiple columns with multiple formulas without returning #R
    By bellsjrb in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-14-2006, 05:05 AM
  6. Sort multiple columns with multiple formulas without returning #R
    By bellsjrb in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-14-2006, 05:00 AM
  7. Replies: 2
    Last Post: 07-07-2006, 10:15 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