+ Reply to Thread
Results 1 to 5 of 5

macro to shade alternating rows

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173

    macro to shade alternating rows

    I am trying to create a macro that will shade different rows of data. The spreadsheet contains ~1000 rows of data and has 10 columns.

    Row 1 contains columns headers.

    The rows below in column A contain account numbers, for example, are as follows:

    Row 2: 5555-5555
    Row 3: 5555-5555
    Row 4: 5555-5555
    Row 5: 5555-5555
    Row 6: 3456-0000
    Row 7: 3456-0000
    Row 8: 3456-0000
    Row 9: 3456-0000
    Row 10: 9967-1111
    Row 11: 9967-1111
    Row 12: 9967-1111
    Row 13: 9967-1111

    What I am trying to do is to change the shading of the rows every time the account number changes.

    So in this example the Header row is gray. Rows A2:J2 - A5:J5 have no shading; rows A6:J6 - A9:J9 are gray; rows A10:J10 - A13:J13 have no shading; etc.

    The end result is I would like to turn the shading feature "on" and turn the shading feature "off" (meaning no shading for all cells with the exception of header row which should always be gray).

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi Try this:-
    Similar numbers in column "A"
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173
    Mick - thanks for the code. It is working fine except is there a way within the code to tell it to shade columns A through J only (10 columns) instead of the whole row?

    Thanks again for your help.

  4. #4
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi, This should do it !
    Please Login or Register  to view this content.
    Regards Mick

  5. #5
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173
    Mick, thank you so much. Perfect solution to my issue.

+ 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