On re-reading your OP and your PM to me I see that I was focusing on the "duplicate" part of your description. In fact, duplicates are not the issue. You simply want shading that alternates between consecutive groups of part numbers. Also possible with CF, though I couldn't figure out how to do it without a helper column. I added a column in AQ. See attached revision below.
By the way I didn't notice the first time that you have a blank row in between every data row, and the blank rows are set to a height of 0.75. Any particular reason to do that? It makes everything else more complicated. You also have lots of merged cells, which aren't really an issue with the shading but can cause other problems.
Also, here is a VBA solution (no helper column required) that would go in the code module for the sheet needing the shading:
Public Sub ShadeAlternatingParts()
Dim R As Long ' row number
Dim LastRow As Long
Dim LastValue As Variant
Dim Shading As Variant
Dim Sequence As Long
LastRow = Cells(Rows.Count, "M").End(xlUp).Row
For R = 12 To LastRow Step 2
If LastValue <> Cells(R, "M") Then
Sequence = Sequence + 1
LastValue = Cells(R, "M")
End If
If Sequence Mod 2 = 0 Then
shadegray Range(Cells(R, "A"), Cells(R, "AO"))
Else
clearshading Range(Cells(R, "A"), Cells(R, "AO"))
End If
Next R
End Sub
Sub shadegray(Rg As Range)
With Rg.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 12632256
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub
Sub clearshading(Rg As Range)
With Rg.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub
Bookmarks