+ Reply to Thread
Results 1 to 4 of 4

Sorting with vba, custom sort?

  1. #1
    Forum Contributor
    Join Date
    08-29-2017
    Location
    London England
    MS-Off Ver
    2016
    Posts
    194

    Sorting with vba, custom sort?

    Hi all,

    I am trying to sort a table in excel, I have the following code so far:

    Please Login or Register  to view this content.
    I know it can be done by key1, key2 and key3 but I did it this way in case I have to add more columns to sort by. I know it would be simple to do without vba, but would like to learn to do it this way.

    So this code works all fine for now, but I would like to add a custom sorting order for the basket size sort. I have lots of basket sizes, I don't know the name of them, but I have ones that start with 05 and I would like those ones to be the first ones for each First name Family name combo.

    I couldn't get it to work in normal excel sort either with the "05*" so I'm not sure how to do this..

    Please help?
    Last edited by LIL2606; 02-15-2019 at 11:29 AM.

  2. #2
    Forum Contributor
    Join Date
    08-29-2017
    Location
    London England
    MS-Off Ver
    2016
    Posts
    194

    Re: Sorting with vba, custom sort?

    I was also thinking the basket size column could be formatted so the cells in it beginning with 05 have a background colour, then do a colour sort? Not sure whats the best way to do this..

    (I have done it with the macro recorder but that code seems like an overkill and I am bad at reverse engineering them...)

    Link to another site I posted the same question: https://www.mrexcel.com/forum/excel-...ml#post5226940

  3. #3
    Forum Contributor
    Join Date
    08-29-2017
    Location
    London England
    MS-Off Ver
    2016
    Posts
    194

    Re: Sorting with vba, custom sort?

    Currently trying to figure out why the sort has a mistake, but there is a working code in the following Workbook.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    08-29-2017
    Location
    London England
    MS-Off Ver
    2016
    Posts
    194

    Re: Sorting with vba, custom sort?

    Here is the finally working code for this (can be cleared up using a with), got help from Fluff from Mr.Excel Message board

    Please Login or Register  to view this content.

+ 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 custom sort orders with Range().sort
    By WestWindsDemon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2018, 03:52 PM
  2. [SOLVED] Sorting by custom sort order not working
    By JavdHo in forum Excel General
    Replies: 12
    Last Post: 06-27-2018, 03:27 PM
  3. invoke sorting using custom sort list
    By eienring in forum Excel General
    Replies: 6
    Last Post: 05-10-2015, 11:47 AM
  4. [SOLVED] How to use custom sort while sorting left to right for entire dynamic used range
    By herbie226 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-05-2012, 11:58 PM
  5. Excel 2007 : Custom sort not sorting completely
    By Sashabaz in forum Excel General
    Replies: 3
    Last Post: 07-10-2009, 11:49 AM
  6. Excel sort by Fill Color by custom list sort
    By Dash4Cash in forum Excel General
    Replies: 2
    Last Post: 07-29-2005, 06:05 PM
  7. Custom sorting-sort the names
    By kexcelf in forum Excel General
    Replies: 0
    Last Post: 03-29-2005, 04:18 AM

Tags for this Thread

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