Hello,
I want to format Pivot Table Rows based on the value of a cell.
this is my pivot table https://docs.google.com/open?id=0B3c...XE3VkhVR0pVQTA
As you can see from the picture (Sorry for the Spanish, i'm Dominican). Every Row is formatted according to the value of the cells
in the las column. if the cell is "AGOTADO" the pivot table row will be grey and if the cell is "VENCIDO" the pivot table row will be red.
My problem is that i want to format the rows starting from the third column up until the last column so that it looks like this:
https://docs.google.com/open?id=0B3c...0lvbHRCYUF2R2M
this is the code that i have so far(which i found on the internet) but i don't know how to change it so that it does what i want:
Sub FormatPT1()
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 .DataBodyRange.Cells
If c.Value = "VENCIDO" Then
With .TableRange1.Rows(c.Row - .TableRange1.Row + 1)
.Font.Bold = True
.Interior.Color = RGB(255, 125, 125)
End With
ElseIf c.Value = "AGOTADO" Then
With .TableRange1.Rows(c.Row - .TableRange1.Row + 1)
.Font.Bold = True
.Interior.Color = RGB(191, 191, 191)
End With
End If
Next
End With
End Sub
Moderator Edit:
Welcome to the forum, MAX8899.
Please notice that [CODE] tags have been added to your post. The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at the top of the page and read Rule #3.
Thanks.
Bookmarks