+ Reply to Thread
Results 1 to 9 of 9

VBA find match in a range

  1. #1
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    VBA find match in a range

    Hi All,
    Im attempting to match a variable value in a dynamic range then fill the appropriate ranges and I am having an issue. The code below works fine when the matching values are on the same row, but the matching values can appear anywhere in the specified column, not just in the same row. In addition, blank values may occur.
    Any help would be greatly appreciated, thanks!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VBA find match in a range

    Normally I would use countif for this sort of thing.

    i.e.

    Please Login or Register  to view this content.
    would give you true if the value in C & intIndex does not exist anywhere in column T. if you change it to >0 then it gives you true if it does exist.

    It's not entirely clear what you are trying to match to where with whole column references though. Hope that helps.

  3. #3
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: VBA find match in a range

    Thanks raguldy, thats definitely a step in the right direction.

    When I run this:
    Please Login or Register  to view this content.
    The red fills in the same row of one instance of a match. I'm attempting to fill the appropriate row (range C:J for an matches in C, and range T:AA for any matches in T.

    Thanks!

  4. #4
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: VBA find match in a range

    Also,

    Here is an example book of representing what I am trying to accomplish.

    Thanks!
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VBA find match in a range

    Try:
    Please Login or Register  to view this content.
    (Assuming that T is now U in your attached example)

  6. #6
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: VBA find match in a range

    Thanks ragulguy, this works great! Is there any way to fill the same area green if heading 2 matches, but heading 4 is different like in the attached workbook?

    Thanks!

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VBA find match in a range

    Try:

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: VBA find match in a range

    Impressive! Thank you very much, it works great!

    I have just one more question, is it possible to have the indented text thats relates to the text title fill the text area blue if heading 2 matches and the indented text does not match, like in the attached example?

    Something like:

    Please Login or Register  to view this content.
    Thanks again!
    Attached Files Attached Files

  9. #9
    Forum Contributor Pierce Quality's Avatar
    Join Date
    07-29-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    221

    Re: VBA find match in a range

    Bumping along

+ 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. Find value in range with two criterias, INDEX MATCH MAX
    By gnoke in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-24-2014, 07:48 AM
  2. Range.Find function fails to find a match but For loop confirms that match exists
    By 6StringJazzer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-08-2013, 03:35 PM
  3. [SOLVED] Find match between ranges, then sum their associated cells in a different range
    By burnettec in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-17-2013, 12:08 AM
  4. Find a match in range and act upon it
    By Vbort44 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-10-2008, 01:24 PM
  5. MATCH - find values in a range <> another range
    By allanr in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-11-2007, 07:39 AM

Tags for this Thread

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