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

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
  • 2
LVL 33

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

808 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