Highlight ROW excel VBA

Posted on 2013-05-18
Last Modified: 2013-05-18
can you please help,
I'm trying to highlight the Row based on if cell Contains specific text  "RETURN"  

Example , cell has this text

it is not Highlighting the Row.

Sub HighLight_Retrun_cells()
i = 2
For Each c In ActiveSheet.Range("E2:E" & Range("E" & Rows.Count).End(xlUp).Row)
    If Cells(i, 5) = "RETURN" Then
        Rng = "A" & i & ":" & "O" & i
        Range(Rng).Interior.ColorIndex = 6
    End If
    i = i + 1
    Next c
End Sub

Any help is appreciated.
Question by:W.E.B
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 34

Accepted Solution

Norie earned 250 total points
ID: 39177766
Try this.
Sub HighLight_Retrun_cells()
Dim c As Range

    For Each c In Sheets("Detail").Range("E2:E" & Range("E" & Rows.Count).End(xlUp).Row)
        If c.Value Like "*RETURN*" Then
            c.Offset(, -4).Resize(, 15).Interior.ColorIndex = 6
        End If
    Next c

End Sub

Open in new window


Author Comment

ID: 39177771
This does it,
thank you.

Author Closing Comment

ID: 39177772

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question