+ Reply to Thread
Results 1 to 13 of 13

Find and highlight cells in workbook that is NOT an exact match to the cell content

  1. #1
    Registered User
    Join Date
    08-09-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Find and highlight cells in workbook that is NOT an exact match to the cell content

    Hi,

    I am trying to run a macro that will search for a word/words that are not an exact match to the target cell and then highlight the cell. I have a demo attached that runs a macro with an input box that works well but only with an exact match.

    For example: I would like to search for "list" but any cell containing "list" will be highlighted e.g. "Check list" or "Quality List" or even "holistic" etc.

    Would anyone be able to help?

    Thanks

    Andy
    Attached Files Attached Files

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find and highlight cells in workbook that is NOT an exact match to the cell content

    in your code, just change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find and highlight cells in workbook that is NOT an exact match to the cell content

    If your code works for the exact match, to do the same for partial match,
    Change
    Please Login or Register  to view this content.
    INTO
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-09-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Find and highlight cells in workbook that is NOT an exact match to the cell content

    Thanks heaps for that millz & AB33, that works a treat!

    The only problem I have now is that there is no option to find the next cell containing the search criteria (similar to normal "Find Next" function). Is there anyway to add this in?

    Thanks

  5. #5
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find and highlight cells in workbook that is NOT an exact match to the cell content

    This is what was recorded by Excel when I made it find for "1" and clicking Find Next 4 times.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-09-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Find and highlight cells in workbook that is NOT an exact match to the cell content

    Thanks for that millz; this only looks for "1" though. Are you able to show how to incorporate the code to "Find" and "Find Next" for the search value?

  7. #7
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find and highlight cells in workbook that is NOT an exact match to the cell content

    I don't know where do you need to add that in

  8. #8
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    818

    Re: Find and highlight cells in workbook that is NOT an exact match to the cell content

    Hi Andy,
    This is not exactly you want but hope you like it.

    Regards,
    tt3
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Find and highlight cells in workbook that is NOT an exact match to the cell content

    Hi Andy,

    Try this:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  10. #10
    Registered User
    Join Date
    08-09-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Find and highlight cells in workbook that is NOT an exact match to the cell content

    Thanks for all your input everyone, it's much appreciated.

    Robert - Thanks for the code but I get an error message at the "varSearchFor = Me.txtValue" point it seems. Apologies but I am extremely new to VBA and so am unable to read the code - I may be missing the obvious. Any help would be great.

    Thanks

  11. #11
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Find and highlight cells in workbook that is NOT an exact match to the cell content

    Hi Andy,

    Not sure what is the issue is as it works fine for me

    Have a look at the attached where I've incorporated my code to your form.

    Regards,

    Robert
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    818

    Re: Find and highlight cells in workbook that is NOT an exact match to the cell content

    Hi Andy,
    Try this one.

    Regards,
    tt3
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    08-09-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Find and highlight cells in workbook that is NOT an exact match to the cell content

    Thanks for the input again but I think I may not have explained exactly what I am after. Below is a breakdown of what I would ideally like:

    1) Search for a partial match via an input box
    2) For the search to find the first occurrence that includes the search text, highlight the cell and move to the relevant worksheet (there are multiple worksheets that need to be searched)
    3) If the first match is not the correct one I would like a method that will jump to the next cell in the workbook that contains the search text (similar to the "Find Next" button through the Find & Replace tool already incorporated in Excel)

    Although the previous macros highlight all the cells they do not take the user to the correct sheet and so the user would have to search through every tab and scroll down each page to find the highlighted cells. Also, all occurrences are highlighted simultaneously instead of one at a time.

    This may be a little complex and I am thinking that maybe I will just have to use the Find & Replace and live with the cells not being highlighted. However, if anyone thinks there is a way to solve the issue any further feedback would be greatly appreciated.

    Thanks

+ 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. [SOLVED] How to find the exact cell content in a column
    By yeshwant_sur in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2012, 02:13 AM
  2. [SOLVED] Highlight a cell if its content doesn't match another cells content
    By noxygen in forum Excel General
    Replies: 4
    Last Post: 04-12-2012, 04:36 AM
  3. Find an exact duplicate match on concatenated cells
    By madball87 in forum Excel General
    Replies: 2
    Last Post: 10-04-2011, 06:07 AM
  4. Highlight entire row instead of cell when find a match?
    By fcb1900 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2010, 07:03 AM
  5. Find exact match in cell with multiple strings
    By Garage23 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-16-2010, 07:23 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