+ Reply to Thread
Results 1 to 8 of 8

How to use a Custom Sort in VBA w/custom list

  1. #1
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    How to use a Custom Sort in VBA w/custom list

    Hi all,

    I'm using an Advanced Filter for Khaki Table Range and would like to sort it based on the Custom List in ADMIN!A45:A65 then by Alphabetical names.

    The code I'm trying to use below is in the SUB Sub KhakiSptCkr_RptTable():

    Please Login or Register  to view this content.
    Thank you for looking and your time.

    V/r,
    Jim
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: How to use a Custom Sort in VBA w/custom list

    Hi Jim,

    Did you create a custom sort first?
    https://support.microsoft.com/en-us/...b-ba213ec2fd61
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Re: How to use a Custom Sort in VBA w/custom list

    MarvinP,

    Yes I did, however this is going to be used by others so my intent is to make the Sort transparent when they run the SUB Sub KhakiSptCkr_RptTable().

    V/r,
    Jim

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: How to use a Custom Sort in VBA w/custom list

    You are mixing up the old & new style sorts, try
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Re: How to use a Custom Sort in VBA w/custom list

    Fluff13,

    Thank you for the Solution. I decided to Sort "KHAKI_TBL" before the running the Advanced Filter. Since "KHAKI_TBL" can viewed also.

    I've slightly modified your code, however

    Please Login or Register  to view this content.
    What I don't get is why is this not Sorting from Row 20. What I'm getting is the Sort starts on Row 21.

    I did try the the Cells (E19 & G19) in the .Sortfields.Add Range with the same results. There has got to be something I'm not seeing.

    V/r,
    Jim

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: How to use a Custom Sort in VBA w/custom list

    As it's a structured table you need to change the Header to xlNo, as it only sorts the data body range.

  7. #7
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Re: How to use a Custom Sort in VBA w/custom list

    Fluff13,

    Well Duh! Haha! I feel a bit dumb. Thank you again for your help. I will be using that technique on this other project I'm building/rebuilding.

    Again it appears as you've been gracious too soon to me as I cannot give you Rep.

    V/r,
    Jim
    Last edited by sorensjp; 07-30-2020 at 07:24 AM.

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: How to use a Custom Sort in VBA w/custom list

    You're welcome & thanks for the feedback.

+ 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. [SOLVED] VBA to custom sort on custom list
    By GregStewartPTC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2018, 12:54 PM
  2. [SOLVED] Custom sort without custom list
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-12-2016, 02:10 PM
  3. Need To Sort By Custom List
    By Michaelsgoldman in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-22-2015, 04:40 PM
  4. Custom Sort List
    By druid98 in forum Excel General
    Replies: 0
    Last Post: 10-10-2011, 07:51 PM
  5. custom list does not sort
    By Matt Lunn in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 09-06-2005, 07:05 PM
  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

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