Hi,
The example here has been simplified.
Sample File︰Test.xlsx (16.57KB) - SendSpace.com
Suppose a PivotTable has already been created with its row fields, column fields, data fields chosen. The result is exactly what the image shows.
The column fields has 2 fields︰"Sex"being position 1, "Region" being position 2.
I hope that, for each pivot item of "Sex"(i.e. "M" & "F"), its occupied label ranges and also ranges of its sub-column field's items will be colored uniquely for identification.
In this case,
- range "B4:D5" will be colored with, say Yellow
- range "E4:H5" will be colored with, say Pale Red
I attempted the following code︰
However, only range "B4:D4" is colored Yellow. How do I also make range "B5:D5" also Yellow﹑
I hope I have expressed myself well.
Many Thanks.
The example here has been simplified.
Sample File︰Test.xlsx (16.57KB) - SendSpace.com
Suppose a PivotTable has already been created with its row fields, column fields, data fields chosen. The result is exactly what the image shows.
The column fields has 2 fields︰"Sex"being position 1, "Region" being position 2.
I hope that, for each pivot item of "Sex"(i.e. "M" & "F"), its occupied label ranges and also ranges of its sub-column field's items will be colored uniquely for identification.
In this case,
- range "B4:D5" will be colored with, say Yellow
- range "E4:H5" will be colored with, say Pale Red
I attempted the following code︰
VBA Code:
Dim PT As PivotTable
With ActiveSheet
Set PT = .PivotTables("Test")
PT.PivotFields("Sex").PivotItems("F").LabelRange.Interior.Color = vbYellow
End With
However, only range "B4:D4" is colored Yellow. How do I also make range "B5:D5" also Yellow﹑
I hope I have expressed myself well.
Many Thanks.