Results 1 to 6 of 6

Auto Sort Overrides Color Sort

Threaded View

  1. #1
    Registered User
    Join Date
    04-16-2018
    Location
    Edmonton, AB
    MS-Off Ver
    Excel 2013
    Posts
    4

    Wink Auto Sort Overrides Color Sort

    I'm making a database for excel. The goal is to have the data input into it Auto sort by color and then Alphabetically.

    I'm using the following VBA to auto sort.

    Private Sub Worksheet_Change(ByVal Target As Range)
    
        On Error Resume Next
        If Not Intersect(Target, Range("A:A")) Is Nothing Then
            Range("A1").Sort Key1:=Range("A2"), _
              Order1:=xlAscending, Header:=xlYes, _
              OrderCustom:=1, MatchCase:=False, _
              Orientation:=xlTopToBottom
    
        End If
    
    End Sub
    And I've set up Macros for the color sorting as follows:

    With Selection.Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .Color = 255
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
        ActiveWorkbook.Worksheets("Master").ListObjects("Table2").Sort.SortFields.Clear
        ActiveWorkbook.Worksheets("Master").ListObjects("Table2").Sort.SortFields.Add( _
            Range("Table2[Name]"), xlSortOnCellColor, xlDescending, , xlSortNormal). _
            SortOnValue.Color = RGB(255, 0, 0)
        With ActiveWorkbook.Worksheets("Master").ListObjects("Table2").Sort
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
    End Sub
    The problem is once I input new data, the alphabetical sort overrides the color sort.

    Can someone please help me make it so that the color sorting overrides the alphabetical?

    Any help is greatly appreciated!
    Last edited by AngXen; 04-17-2018 at 01:44 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Auto Sort by Color
    By indhrui in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-08-2016, 02:52 AM
  2. Auto Sort line items based off of cell color
    By Jscott1601 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-15-2013, 11:43 AM
  3. Auto Sort line items based off of cell color
    By Jscott1601 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-11-2013, 03:03 PM
  4. Auto Sort, Auto Lock, Auto Date & Time Stamp
    By suehatesyou in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-23-2010, 02:57 PM
  5. Can I "auto-sort" or use a quick button to sort?
    By drewkloc71 in forum Excel General
    Replies: 4
    Last Post: 09-07-2009, 03:14 AM
  6. [SOLVED] Sort or sub-total by Fill color or font color
    By Excel_seek_help in forum Excel General
    Replies: 1
    Last Post: 04-27-2006, 04:10 PM
  7. [SOLVED] 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

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