+ Reply to Thread
Results 1 to 7 of 7

code to highlight rows and add two columns

  1. #1
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    code to highlight rows and add two columns

    Can you please modify the code below, especially the IF statement (should be if any value in J2:J is <=120 or Yellow Then D2:D is Red). Also, is the reads code correct? Thank you very much.

    Please Login or Register  to view this content.

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

    Re: code syntax

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: code to highlight rows and add two columns

    What does this mean "(H2:H + I2:I <+120)"?

    is it also possible to color column D the same as the range (for example if J2 is Yellow D2 is Red and if J3 is orange then D3 is Red)
    Yes. Like this
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: code to highlight rows and add two columns

    Sorry that's a typo, should be H2:H + I2:I <=120

    Looking to add column H + J and if that sum is less then or equal to 120 then column H and J turn orange.

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: code to highlight rows and add two columns

    hi cmccabe, why do you not use conditional formating to do those colouring without VB?

  6. #6
    Forum Contributor
    Join Date
    05-09-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2016
    Posts
    543

    Re: code to highlight rows and add two columns

    It makes it easier with macro in this case then to use conditional formatting.

  7. #7
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: code to highlight rows and add two columns

    watersev brings up an excellent point. I will answer with what I think you are asking for in macro form.

    Please Login or Register  to view this content.
    This will check the addition of column H & J and if less than or equal to 120 will highlight column J and D accordingly. The next loop is untouched as I do not believe it was part of your question.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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