Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel: Find certain cells based on text colour. 1

Status
Not open for further replies.

micang

Technical User
Aug 9, 2006
626
US
Hi All,

Excel 2003:

I have a list of text in a column. Some of these text values are in red colour.

I would like to identify these cells that have text in red, by putting a "1" in the adjacent cell.

Is this possible?

Many thanks

Michael
 
Very

You need a loop to go through your list and where the returned color is red then make the next row / column = 1

Code:
isred = 123 ' What ever color red is 

if IsRed = Cells(x, y).Interior.Color then
   'make next cell equal 1 
   Cells(x, y +1).value = 1
end if
 
Michael

Try something along the lines of:

Code:
Sub see_red()
For Each cll In Selection
    If cll.Font.ColorIndex = 3 Then
        cll.Offset(0, 1) = 1
    End If
Next cll
End Sub

Highlight the column or the cells you want to check and then run the macro.

I find it easiest to use the macro recorder when performing the desired action (here, turning certain cells red) and then modifying the code.

Fen
 
Fen,

Thank you so much, that works perfectly. Much appreciated.

Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top