Results 1 to 2 of 2

Sort column based on cell color

Threaded View

  1. #1
    Registered User
    Join Date
    04-20-2013
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    96

    Sort column based on cell color

    Hi,

    Attached is a workbook where I need to sort column B based on color. I need any cells having green color to be on top. I have the following code but it's not working. I haven't been able to find out why it's not working. Any help will be highly appreciated.


        Range("B1").Select
        Selection.AutoFilter
        Range(Selection, Selection.End(xlDown)).Select
    
        ActiveSheet.AutoFilter.SORT. _
            SortFields.Clear
    
        ActiveSheet.AutoFilter.SORT. _
            SortFields.Add(ActiveCell.Offset(1, 0).Range("A1:A" & LastRow), xlSortOnCellColor, _
            xlAscending, , xlSortNormal).SortOnValue.Color = RGB(146, 208, 80)
    
        With ActiveSheet.AutoFilter.SORT
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
    
        Selection.AutoFilter
        
        Application.CutCopyMode = False
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. sort all white fill cell on column I based on cell value specific txt if (true)
    By raijinlee in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-01-2017, 01:57 AM
  2. [SOLVED] VBA to Sort Rows Based on Cell's Backgroun Color/Colour
    By Taisir in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-06-2015, 07:09 AM
  3. 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
  4. 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
  5. [SOLVED] Color-format a cell which contains data in a column based on the color of another cell
    By Nit3hawK in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2013, 05:25 PM
  6. VBA code ,Autofill color of a column based on cell value
    By mubashar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2013, 11:50 AM
  7. Sort a column based on Font Color
    By tdyl1969 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2010, 11:30 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