Results 1 to 7 of 7

Highlight cells in column of found text string - Rework

Threaded View

  1. #1
    Forum Contributor delaing's Avatar
    Join Date
    07-16-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    192

    Highlight cells in column of found text string - Rework

    In a previous post, my request was provided and implemented, thus labeled "Solved".
    http://www.excelforum.com/showthread...t=#post4187076

    Not sure why, but now I'm getting unwanted results.

    Goal: Highlight, with yellow, the cells in the column with the column heading "ACCT #" - below the label and not above it, nor in an area outside of the pertinent data table.

    Attached is an xlsx showing the BAD results of the code and with the two areas that are being highlighted but not desired. Then one showing Good results of the highlighting. I do see one difference being that the cells above "ACCT #" are empty in this one, but need it to work if there is data above the Column label as in the bad highlight example, if possible.

    Here is the section of code that does the work:
        With ActiveSheet
        
        .AutoFilterMode = False
        Set c = .Rows("4:10").Find("ACCT", , xlValues, xlPart) '3/29/16 -dg- changed "xlWhole" to "xlPart" for partial match.
        If c Is Nothing Then
            MsgBox ("Could not find ACCT in row 4 thru 10")
            Exit Sub
        End If
        .Range(.Cells(1, c.Column), .Cells(.Cells(Rows.Count, c.Column).End(xlUp).row, c.Column)).AutoFilter 1, "<>"
        .Range(.Cells(2, c.Column), .Cells(.Cells(Rows.Count, c.Column).End(xlUp).row, c.Column)).SpecialCells(xlCellTypeVisible).Interior.Color = vbYellow
        .AutoFilterMode = False
        End With
    This is indeed part of a larger module and I can insert that also, but there is a lot to weed through that shouldn't be impacting this.

    Let me know where I need to clarify in this request.

    Thank you,
    Delain
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Highlight cells in column of found text string
    By delaing in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 09-11-2015, 02:15 PM
  2. Replies: 2
    Last Post: 04-17-2014, 03:30 PM
  3. [SOLVED] IF range of cells contains string of text, return contents of cell where string is found
    By nobodyukno in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-03-2013, 09:56 AM
  4. Replies: 3
    Last Post: 10-25-2012, 12:49 AM
  5. highlight a row when text found
    By Tortus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-20-2012, 07:36 AM
  6. Replies: 1
    Last Post: 09-19-2009, 08:09 PM
  7. [SOLVED] Search column - return row found in long text string
    By JayL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2005, 12:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1