+ Reply to Thread
Results 1 to 10 of 10

Color entire row depending on value in a column

  1. #1
    Forum Contributor
    Join Date
    11-05-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    181

    Color entire row depending on value in a column

    Greetings! I'm hoping someone can help me with this logic for my macro.

    I have expiration dates located in Column N and need to color the entire row depending on what the expiration date is.

    Expiration date is >90 days from today = Green
    Expiration date is <=90 days from today =Yellow

    The biggest confusion for me is the filtering criteria- how can I filter for greater than 90 days from today?

  2. #2
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Color entire row depending on value in a column

    You can use (e.g.): $N2>Today()+90

    It sounds like conditional formatting might be a better fit than a macro, though.

  3. #3
    Forum Contributor
    Join Date
    11-05-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    181

    Re: Color entire row depending on value in a column

    Thanks, Cantosh but I need to use a macro for this piece.

  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: Color entire row depending on value in a column

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-05-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    181

    Re: Color entire row depending on value in a column

    Thanks, John!! Your code didn't completely work, but it gave me the guidance I needed. Below code is working perfectly, for anyone interested.

    Thanks again!

    Please Login or Register  to view this content.

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

    Re: Color entire row depending on value in a column

    You're welcome. Glad I could help.

  7. #7
    Forum Contributor
    Join Date
    11-05-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    181

    Re: Color entire row depending on value in a column

    So I tried the macro below on a new data set and it looks like if the filter does not include data the header row is colored.

    Please see my attachment. Any help/guidance would be greatly appreciated. First tab shows what the data is like post-macro and second tab is the ideal outcome. I believe it may have something to do with the portion End(3)?

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

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

    Re: Color entire row depending on value in a column

    Try:

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    11-05-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    181

    Re: Color entire row depending on value in a column

    Thanks, but that didn't work for me. I got the same result as the initial macro with the header row highlighted.

  10. #10
    Forum Contributor
    Join Date
    11-05-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    181

    Re: Color entire row depending on value in a column

    For anyone interested, here's the piece that was missing: I forgot to include If condition. If there was nothing filtered to move to the next statement.

+ 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] Loop & color code entire row depending on criteria
    By StevenChen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2013, 02:42 PM
  2. Replies: 3
    Last Post: 10-27-2012, 10:33 PM
  3. Change color of entire rows if a value is entered in a cell in column I
    By patrickmcdiver in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-23-2012, 08:04 AM
  4. Replies: 3
    Last Post: 08-24-2012, 12:24 PM
  5. Color entire column and row of cursor location
    By Anotherjohn in forum Excel General
    Replies: 3
    Last Post: 09-29-2006, 08:53 AM
  6. Replies: 3
    Last Post: 08-22-2006, 04:20 PM
  7. Replies: 1
    Last Post: 05-03-2006, 11:15 PM

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