View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gord Gord is offline
external usenet poster
 
Posts: 86
Default VBA Search worksheet, find text, change color of row

Since you are in the programming group I will assume you want a macro.

Sub color_rows()
Dim RngCol As Range
Dim i As Range
Set RngCol = Range("B1", Range("B" & Rows.Count). _
End(xlUp).Address)
For Each i In RngCol
If i.Value = "mystring" Then
i.EntireRow.Interior.ColorIndex = 3
End If
Next i
End Sub

There are ways to do it without VBA...............see help on
Conditional Formatting.


Gord Dibben Microsoft Excel MVP

On Fri, 22 Jul 2011 08:55:12 -0400, "Saucer Man"
wrote:

What's the easiest way to search a worksheet for certain text in a column
and if found, change the color of the row (highlight)?

Thanks!


--- Posted via news://freenews.netfront.net/ - Complaints to ---