I have a quick query .I want to filter the columns using colors.For examplelet say I have a range from A2:A50 and are colred blue,green etc.I want toselect those cells which have green color.Can any one give some small subroutine for it.
you cant to filter by color , excel not support in this.you must create private function then use it for fillterb2 = bcolor(a2) etc....Function bColor(r As Range) As IntegerbColor = r.Interior.ColorIndexEnd Function
See http://www.mvps.org/dmcritchie/excel/colors.htm for the Excel colorpalette.Green is .ColorIndex = 10You 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 thatcolumn with 1 or 0, depending on whether theIf Range("A:" & Row).Interior.ColorIndex = 10 ThenRange ("F" & Row).Value = 1ElseRange ("F" & Row).Value = 0End IfAnd then do a normal sort.