+ Reply to Thread
Results 1 to 2 of 2

Sorting a sheet based on cell color in specific column

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

    Sorting a sheet based on cell color in specific column

    Hi,

    I'm trying to sort a spreadsheet based on cell color in a specific column using the code below, but I get a message "Method 'Range' of object'_Global' failed". What am I doing wrong? Rows 1 through 4 are not to be included in the sort, that's why I'm setting the range starting in "D5". Hope someone can help me with this.

    ActiveSheet.SORT.SortFields.Clear
    ActiveSheet.SORT.SortFields.Add(Range("D5:D"), _
    xlSortOnCellColor, xlAscending, , xlSortNormal).SortOnValue.Color = RGB(141, 180, 226)

    With ActiveSheet.SORT
    .SetRange Range("D5:D")
    .Header = True
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
    End With


    Thanks!

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Sorting a sheet based on cell color in specific column

    Excel 2010 and higher have "sort by colour" built in. Why re-invent the wheel?

+ 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] Sorting a sheet A-Z, based on specific column
    By axtryo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-04-2016, 08:50 PM
  2. Color Cell Based on Specific Text in Other Cell and Sorting Based on Results
    By kre30a in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2016, 07:51 PM
  3. Data Sorting to New sheet of specific column
    By csrahul in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2016, 01:39 PM
  4. [SOLVED] Dynamically color cell on Summary sheet based on column values on data sheet
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-08-2016, 12:59 PM
  5. [SOLVED] Copy cells in another sheet if 1st sheet has a certain color in a specific column
    By ccellarius32 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-02-2014, 05:08 PM
  6. [SOLVED] copying specific certain column data based on cell/column value to another sheet
    By arctic7 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-09-2012, 03:38 PM
  7. Color Cells Automatically based on Value in Specific Column
    By FallingDown in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-03-2012, 09:54 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