filtering colours

P

p3project

Guys

Can you tell me if it is possible to filter rows identified by colou
plz? If so, how do you do this??

Any help would be most welcome

Thanks

Dav
 
J

Jason Morin

Not directly. You can create a user-defined function, use
this function to return the color index of the current
cell, and then filter by color index.

1. Press ALT+F11.
2. Go to Insert > Module.
3. Paste in the following code:

Function cellcolor(Target As Range)
cellcolor = Target.Interior.ColorIndex
End Function

4. Click back into XL.
5. In the next open column, put a header like "Color".
6. In the next cell of this column, call the function
like:
=cellcolor(D2)
7. Now copy this cell, select the rest of the column, and
do Edit > Paste Special > Formula
8. Now apply your AutoFilter and filter on this new col.

HTH
Jason
Atlanta, GA
 
Top