I've been working on this for HOURS now , so any help would be EXTREMELY appreciated ! I'm just trying to highlight the rows in my Client Detail Account PivotField based on another PivotField.
I have 2 Pivot Fields in this order:
1. Client Detail Account
2. Detail Service Code
So, If the Detail Service Code PivotField contains the ZBA MASTER ACCOUNT MAINT PivotItem, the code should highlight the Client Detail Account PivotField (ONLY THE Client Detail Account ROWS THAT MEET THE CRITERIA).
Currently, there are no errors in the code, but it highlights every single row of the Client Detail Account PivotField. Here is the potential culprit:
.PivotSelect "'Client Detail Account'", xlDataAndLabel + xlFirstRow, True
Here is the full code:
Sub Colors_Click(control As IRibbonControl)
Dim c As Range
With ActiveSheet.PivotTables("Pivottable1")
' reset default formatting
With .TableRange1
.Font.Bold = False
.Interior.ColorIndex = 0
End With
' apply formatting to each row if condition is met
For Each c In .PivotFields("Detail Service Code").PivotItems("ZBA MASTER ACCOUNT MAINT ").DataRange.Cells
If c.Value >= 1 Then
.PivotSelect "'Client Detail Account'", xlDataAndLabel + xlFirstRow, True
Selection.Interior.Color = vbYellow
End If
Next
End With
End Sub
Any insight into how to make this happen would be MUCH APPRECIATED!
Bookmarks