+ Reply to Thread
Results 1 to 4 of 4

Changing Colors of Alternating Rows

  1. #1
    Registered User
    Join Date
    01-02-2009
    Location
    pittsburgh, pa
    MS-Off Ver
    Excel 2007
    Posts
    52

    Changing Colors of Alternating Rows

    How do I change the colors of every other row that has values in it?

    i.e.

    I have values in rows 1 through 34. I want rows 2,4,6, etc to change to a light green color.

    Thanks

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Changing Colors of Alternating Rows

    Select entire range from rows 1 to 34 and go to Format|Conditional formatting:

    Select Formula Is from 1st drop down and enter formula: =MOD(ROW(),2)=1

    Then click format to choose your colour pattern

    If you want to start highlighting with Row 2, then use: =MOD(ROW(),2)=0 instead (after selecting from row 1 down).
    Last edited by NBVC; 03-23-2009 at 02:50 PM.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    01-02-2009
    Location
    pittsburgh, pa
    MS-Off Ver
    Excel 2007
    Posts
    52

    Re: Changing Colors of Alternating Rows

    That works, but the spreadsheet I have uses macros to create a new tab when a button is pressed. And the new tab can have values in any given number of rows depending on the input values in the original page. So one run could have values in 20 rows. And another run can put values in 40 rows. I want every other row highlighted only up to as many rows have values in it for THAT run.

    Edit: I am using 2007. I believe the previous response was for 2003.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Changing Colors of Alternating Rows

    Then you will need to highlight all columns that are contained in the rows and edit your CF formula to:


    =AND($A1<>"",MOD(ROW(),2)=0)

    where it is assumed that the row should follow the conditional format as long as there are values in column A.

+ 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