Sort by Colour (color)???

Peter Rouse

New Member
Joined
Feb 28, 2002
Messages
14
I know this may sound a bit eccentric, but is it possible to sort a list by the fill colo(u)r of the cell?
Suffice to say, we have a humungeous list of units, which are classified only by the fill color. This originated as a legacy system and comes from worksheets sent to us by different groups, but all use this colour coding. The colour represents various company business units as well as locations.
Any ideas?
Thanks

Peter
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
One way to do this is to create a column of the colorindex for your cells and then sort on these numbers. You can write a macro to assign the indexes. Something like

Sub ColorNameIndex()
Dim cel As Range
Dim MyValue As Integer
Dim myArea As Range
Set myArea = Selection
For Each cel In myArea
MyValue = cel.Interior.ColorIndex
cel.Offset(0, 1).Value = MyValue
Next
End Sub

By selecting a column, this macro will insert the color index in the next column. Adjust as needed

HTH
 
Upvote 0

Forum statistics

Threads
1,203,606
Messages
6,056,278
Members
444,854
Latest member
goethe168

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