Sort By Colored Cell?

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hello,

Not that I am aware of, but you could create some VB, whereby a column is created with the colour number in then sort by this column
 
Upvote 0
Hi,

assuming you are NOT talking about conditional formatting

NateO once gave me this link
http://www.utteraccess.com/forums/showflat.php?Number=1147043&fpart=2.3

this should be faster then Chip Pearsons code, you will se the difference when used on large ranges
Code:
Option Explicit

Sub sort_by_color()
'Erik Van Geit
'060625

Const col = 3

Application.ScreenUpdating = False
ThisWorkbook.Names.Add Name:="Color", RefersToR1C1:="=GET.CELL(63,!RC[" & col & "])"

    With Worksheets(1)
    .Columns(1).Insert
        With .Range(.Cells(1, 1), .Cells(.Cells(.Rows.Count, col + 1).End(xlUp).Row, 1))
        .Formula = "=Color"
        .Resize(.Rows.Count, Columns.Count).Sort key1:=.Cells(1, 1)
        End With
    .Columns(1).Delete
    End With
    
    
ThisWorkbook.Names("Color").Delete
Application.ScreenUpdating = True

End Sub


kind regards,
Erik

EDIT: added one dot in the code
With .Range(.Cells(1, 1), .Cells(.Cells(.Rows.Count, col + 1).End(xlUp).Row, 1))
 
Upvote 0

Forum statistics

Threads
1,225,481
Messages
6,185,239
Members
453,283
Latest member
Shortm88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top