+ Reply to Thread
Results 1 to 5 of 5

Highlight rows multiple criteria vba

  1. #1
    Forum Contributor
    Join Date
    07-14-2012
    Location
    Belgium/UK
    MS-Off Ver
    Excel 2003
    Posts
    111

    Highlight rows multiple criteria vba

    Hello,

    Looking for a code that highlights rows when criteria are met (or not) via a InputBox.

    e.g.: run macro, input box 1: enter premium, input box 2: enter selected. Run throw the rows and every row that has "premium" and "selected" higlights green, but if there is only 1 of the criteria in the row, highlight red.

    Attached is sample of the expected result.


    I tried changing the following code as it highlights cells but no luck.

    Please Login or Register  to view this content.
    Any help appreciated.

    Red
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,242

    Re: Highlight rows multiple criteria vba

    This code is a bit more straightforward, and it works. You will need to add code to accumulate the counts, if you need counts. You can also add error messages, if you want.

    Please Login or Register  to view this content.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    07-14-2012
    Location
    Belgium/UK
    MS-Off Ver
    Excel 2003
    Posts
    111

    Re: Highlight rows multiple criteria vba

    Hello sir,
    thank you for the reply. Indeed it works on the sample sheet, but my mistake. I should have mentioned that the search of the Inputbox is not limited to a specific column, as this changes from client to client.
    After adding the code to live data, nothing actually happens (even after I changed the columns).

    Would it be dependent on case sensitive and hidden columns?

    Sample sheet with live cleaned data attached.
    Attached Files Attached Files
    Last edited by realrookie; 07-07-2016 at 11:47 AM.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Highlight rows multiple criteria vba

    Another:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-14-2012
    Location
    Belgium/UK
    MS-Off Ver
    Excel 2003
    Posts
    111

    Re: Highlight rows multiple criteria vba

    Mr Davis,

    Wonderful as always. But this runs to good. It does what I ask, but when I added it to the live data, i got more results then I expected. Live data has around 28k rows of products and up to Column AP.

    Is there a way, so that I can tell it in which column to search first for Criteria 1, and based on those results it would search the rest of the row (where criteria 1 was found) for criteria 2.

+ 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] Highlight cell for a criteria within multiple rows
    By ameeto.nike in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 02-02-2016, 10:34 PM
  2. [SOLVED] Highlight Duplicate Rows Based on Multiple Criteria
    By freybe06 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-15-2013, 09:39 AM
  3. Replies: 1
    Last Post: 10-30-2012, 05:40 PM
  4. Replies: 7
    Last Post: 09-13-2011, 12:04 PM
  5. Highlight according to multiple criteria
    By Rage in forum Excel General
    Replies: 6
    Last Post: 10-04-2010, 07:11 AM
  6. Identify/highlight maximum value based on multiple criteria
    By JennB in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-06-2009, 06:28 PM
  7. [SOLVED] match multiple criteria and highlight corresponding row in Excel
    By D Assess in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-02-2006, 12:30 PM

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