Results 1 to 6 of 6

Problem in a custom sort code

Threaded View

  1. #1
    Registered User
    Join Date
    05-27-2021
    Location
    Strasbourg, France
    MS-Off Ver
    2010
    Posts
    28

    Question Problem in a custom sort code

    Hello the forum,

    I have a problem in the code of my workbook, code that I attach in the topic with the file. I would like to do a custom sorting in all the tabs in column E by means of a vba code. Because this file will be shared and it is not possible to export a personal sort...

    Thank you in advance for your help.


    Private Sub CommandButton1_Click()
        Dim Ws As Worksheet
        On Error Resume Next
        For Each Ws In Worksheets
            If Ws.Name <> "CONFIG" Then
                With Ws.ListObjects(1)
        Sort.SortFields.Clear
        Sort.SortFields.Add _
            Key:=Range("E:E"), SortOn:=xlSortOnValues, Order:= _
            xlAscending, CustomOrder:=" 1-0-0,1-1-0,1-1-1,1-1-2,1-1-3,1-1-4,1-2-0,1-2-1,1-2-2,1-2-3,1-2-4,1-3-0,1-3-1,1-3-2,1-3-3,1-3-4,1-4-0,1-4-1,1-4-2,1-4-3,1-4-4,1-5-0,1-5-1,1-5-2,1-5-3,1-5-4,1-6-0,1-6-1,1-6-2,1-6-3,1-6-4,1-7-0,1-7-1,1-7-2,1-7-3,1-7-4,1-8-0,2-0-0,3-0-0,2-1-0,2-1-1,2-1-2,2-1-3,3-1-1,3-1-2,3-1-3,3-1-4,2-2-0,2-2-1,2-2-2,2-2-3,3-2-1,3-2-2,3-2-3,3-2-4,2-3-0,2-3-1,2-3-2,2-3-3,3-3-1,3-3-2,3-3-3,3-3-4,2-4-0,2-4-1,2-4-2,2-4-3,3-4-1,3-4-2,3-4-3,3-4-4,2-5-0,2-5-1,2-5-2,2-5-3,3-5-1,3-5-2,3-5-3,3-5-4,3-6-1,3-6-2,3-6-3,3-6-4,2-6-0,2-6-1,2-6-2,2-6-3,3-7-1,3-7-2,3-7-3,3-7-4,3-8-1,3-8-2,3-8-3,3-8-4,2-7-0,2-7-1,2-7-2,2-7-3,2-8-0,5-1-0,5-2-0,5-3-0,4-1-0,4-2-0,4-3-0,4-4-0,5-4-0,5-5-0,4-5-0,4-6-0,5-6-0,5-6-1,5-7-0,4-7-0,4-8-0,5-8-0,5-8-1,5-9-0,4-9-0,4-10-0,5-10-0,5-11-0,6-1-0,6-2-0,6-3-0,6-4-0,6-5-0,6-6-0,6-7-0,6-8-0,6-9-0,6-10-0,6-11-0,0,Sur chaîne,A determiner,Servantes visserie", DataOption:=xal
        With Ws.ListObjects(1).Sort
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
        End With
        End If
        Next
    End Sub
    Attached Files Attached Files
    Last edited by Benten667; 06-25-2021 at 10:20 AM. Reason: File uptade

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] vba code - Custom Sort on row1 - Left to Right
    By excel_googler in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-31-2021, 12:50 PM
  2. [SOLVED] Custom Sort VBA Problem
    By benjhardie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-11-2019, 06:23 AM
  3. [SOLVED] custom sort simplify code
    By hopefulhart in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2017, 09:17 PM
  4. Code For A Custom Sort Using A List On Another Sheet
    By rockyw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-06-2016, 08:51 PM
  5. Custom List Sort - A struggling problem
    By rakesh_sss in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-29-2012, 02:50 AM
  6. Custom sort order problem
    By mfmcclellan in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-04-2012, 05:05 PM
  7. Add Custom Sort List to VBA code
    By Zyphon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-12-2009, 09:44 AM

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