+ Reply to Thread
Results 1 to 6 of 6

VBA code to highlight row where column contains specific text.

  1. #1
    Forum Contributor
    Join Date
    03-09-2012
    Location
    Isle of Man
    MS-Off Ver
    Excel 2010
    Posts
    118

    VBA code to highlight row where column contains specific text.

    Hi Guys,

    I have created a macro that for colleagues that identifies when data in a worksheet needs amending. A message box pops up to let them know there is an error. I would like to assist them more by highlighting the rows where the data needs fixing.

    Column C contains an IFERROR formula that brings up text "Transaction ref doesn't match client ref" if there is an error.

    Could anybody help me with some code that would highlight rows where column C contains the word "match". The cell will contain other text as well as the word "match".

    Thanks in advance.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: VBA code to highlight row where column contains specific text.

    Why don't you just use Conditional Formatting? That would be more flexible than VBA as you wouldn't have to undo the highlights when the errors are corrected.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: VBA code to highlight row where column contains specific text.

    Conditional formatting seems the best solution but you could also assist them by selecting the row that has a mistake.

    Apperently you have a code already that finds the mistake and informs them with a message box
    you could ask them then if they want to check the errors now and simply select the row that created the error.

  4. #4
    Forum Contributor
    Join Date
    03-09-2012
    Location
    Isle of Man
    MS-Off Ver
    Excel 2010
    Posts
    118

    Re: VBA code to highlight row where column contains specific text.

    Thanks for the comments.

    The workbook is created from scratch in the macro so conditional formatting can't be set up beforehand. There could be multiple errors in the workbook so I'm not sure how to select the rows that have errors.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: VBA code to highlight row where column contains specific text.

    Use Autofilter based on text "Transaction ref doesn't match client ref"

  6. #6
    Forum Contributor
    Join Date
    03-09-2012
    Location
    Isle of Man
    MS-Off Ver
    Excel 2010
    Posts
    118

    Re: VBA code to highlight row where column contains specific text.

    Thanks for you contributions guys but I figured it out.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA code to identify the cell number in a column which contains a specific text
    By rshnkmr39 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-09-2014, 03:38 AM
  2. Replies: 2
    Last Post: 04-17-2014, 03:30 PM
  3. InStr function doesn't find specific text, but finds any text in column and runs code
    By mikey3580 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-27-2014, 03:50 AM
  4. Replies: 20
    Last Post: 01-11-2014, 05:39 AM
  5. [SOLVED] Cond. formatting a column/Range, highlight cell in column/range if equal to specific text
    By DFrank231 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-19-2013, 03:35 PM
  6. Replies: 11
    Last Post: 03-04-2013, 12:57 PM
  7. Macro or VBA code to highlight specific named columns in a column chart
    By glenp99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-03-2010, 05:12 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