ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatically highlighting rows which contains certain data (https://www.excelbanter.com/excel-programming/296823-automatically-highlighting-rows-contains-certain-data.html)

Ian M[_2_]

Automatically highlighting rows which contains certain data
 
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

Nigel[_8_]

Automatically highlighting rows which contains certain data
 
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


"Ian M" wrote in message
om...
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




Ian M[_2_]

Automatically highlighting rows which contains certain data
 
Nigel

This works perfectly.

Thank you for your help.

Kind regards

Ian M



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com