+ Reply to Thread
Results 1 to 2 of 2

Shading alternate groups, not rows?

Hybrid View

  1. #1
    Registered User
    Join Date
    05-22-2014
    Posts
    1

    Question Shading alternate groups, not rows?

    I'm sorry to join and then immediately ask questions, but I'm in a bit of a fix and have been able to find almost nothing pertaining to my situation online.
    It is very easy to make Excel automatically colour every other row. But I need to colour every other group. My workplace has a standard procedure for certain kinds of spreadsheets: We gather the relevant data from our database (names, organizations, etc.), and then sort them according to organization. Then, we manually shade every other group of rows that belong to that organization. So, for instance, if there are six organizations, we would sort them and then shade organizations 2, 4 and 6. Now, these groups are rarely the same size, so I cannot just get Excel to shade every other group of three rows. Organization 1 may have four entries, and Organization 2 may have only one, for instance. So, the first four rows would not be shaded, but then the next one would be. Then however many entries Organization 3 has would be shaded, et cetera. It would save us a great deal of time, in the long run, if we could get excel to automatically alternate shading by group, but I can find little advise on how to do that. Is it really possible?

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Shading alternate groups, not rows?

    Try this:-
    Sub MG22May03
    Dim Rng         As Range
    Dim Dn          As Range
    Dim Temp        As String
    Dim col         As Integer
    Dim fd          As Boolean
    Set Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
    Temp = Rng(1)
    For Each Dn In Rng
        If Not Temp = Dn Then
            fd = fd Xor True
            col = IIf(fd, 34, xlNone)
        End If
    Dn.Offset(, 2).EntireRow.Interior.ColorIndex = col
    Temp = Dn
    Next Dn
    End Sub
    Regards Mick

+ 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] Shading Alternate Unhidden Rows in Excel
    By CrocHntr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-06-2014, 09:01 AM
  2. [SOLVED] Alternate Shading Without Printing Blank Rows
    By Hazarrd in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 05:31 PM
  3. Alternate shading of range of rows when when sell value changes
    By libinxu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-19-2012, 05:36 PM
  4. Alternate Shading (fill color) every three rows
    By jeaux11 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 02-08-2008, 04:42 AM
  5. [SOLVED] shading alternate rows, but losing format when one row is deleted
    By Candice in forum Excel General
    Replies: 8
    Last Post: 05-10-2006, 11:10 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