Automatically highlighting rows which contains certain data

I

Ian M

In my Excel Workbook, I want the macro to find every row which
contains a cell containing the text "Robert" and then highlight this
row my shading it light grey.

The number of rows containing "Robert" changes all the time.

I know I need a Do ... Until statement, however I can't seem to come
to grips with the syntax and how to fit it into the macro.

Thanks.

Ian M
 
N

Nigel

The following code behind the workbook will detect the entry as it is made
and set the row to grey if the cell contains Robert and reset it to no fill
if the word is removed

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
With Sh
With Target
If .Cells.Text = "Robert" Then
Rows(Target.Row).Interior.ColorIndex = 15
Else
Rows(Target.Row).Interior.ColorIndex = xlNone
End If
End With
End With
End Sub
 
Top