• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to limit yellow highlighting of a row between columns A and H?

Status
Not open for further replies.

Eloise T

Active Member
The attached Workbook contains 3 tabs. Data is added each week to the tabs. The VBA macro "YellowHighlightColumnsAThroughH" when run will highlight the newly added rows of data. However, I do not want the macro to yellow highlight a row where Column H contains, "NO INV" or any extension thereof, e.g. NO IN, NO INV, NO INVOICE, NO INVOICE THIS WEEK, etc.

The CODE below works without the line:
If ws.Range("A3:H") <> "NO IN" Then (with its accompanying End If of course)
but it colors all rows with data including those containing "NO IN"

Please see the attachment and the tab labeled "Paul."
I need help modifying that line: If ws.Range("A3:H") <> "NO IN" Then
so it will not yellow highlight any line A - H containing "NO IN" etc.
Thank you for your assistance in advance.

Code:
Sub YellowHighlightColumnsAThroughH()
    Dim ws As Worksheet
    For Each ws In ThisWorkbook.Worksheets
        If ws.Name <> "Formula Info" And ws.Name <> "Dave" Then
            If ws.Cells(Rows.Count, "A").End(xlUp).Row > 2 Then                'Changed 3 to "A" which is the same.

                If ws.Range("A3:H") <> "NO IN" Then
                    ws.Range("A3:H" & ws.Cells(Rows.Count, 3).End(xlUp).Row).Interior.Color = vbYellow  '= RGB(255, 255, 0)
                End If

            End If
        End If
    Next
End Sub
 
Last edited:

Attachment is missing and yet asked in your previous thread.

As a duplicate, this one is closed ! To be continued in initial thread …​
 
Status
Not open for further replies.
Back
Top