Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Filtering rows by colors

  Asked By: Juana    Date: Aug 27    Category: MS Office    Views: 666
  

I have a quick query .I want to filter the columns using colors.For example
let say I have a range from A2:A50 and are colred blue,green etc.I want to
select those cells which have green color.Can any one give some small sub
routine for it.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Niran Jainukul     Answered On: Aug 27

you cant to filter  by color  , excel not support in this.

you must create private function then use it for fillter

b2 = bcolor(a2) etc....

Function bColor(r As Range) As Integer
bColor = r.Interior.ColorIndex
End Function

 
Answer #2    Answered By: Femke Bakker     Answered On: Aug 27

See http://www.mvps.org/dmcritchie/excel/colors.htm for the Excel color
palette.

Green is .ColorIndex = 10

You also want to know what cell property to refer to, e.g.
ActiveCell.Interior.ColorIndex = 10.

And now you can write a custom sort routine in VBA.

I would add another column, and populate the value of cells  in that
column with 1 or 0, depending on whether the
If Range("A:" & Row).Interior.ColorIndex = 10 Then
Range ("F" & Row).Value = 1
Else
Range ("F" & Row).Value = 0
End If

And then do a normal sort.

 
Didn't find what you were looking for? Find more on Filtering rows by colors Or get search suggestion and latest updates.




Tagged: