pulsecoding
New Member
- Joined
- May 26, 2011
- Messages
- 31
Team
I need pivot for below table. where count of type needs to be displayed against team names something like below. but when I run the below code, the column headings ("not operation", "operation" )does not display. it only shows total count.
data
Pivot
I need pivot for below table. where count of type needs to be displayed against team names something like below. but when I run the below code, the column headings ("not operation", "operation" )does not display. it only shows total count.
data
team | type |
bb | not operation |
aa | operation |
bb | not operation |
Pivot
team | not operation | operation |
bb | 2 | |
aa | 1 | |
VBA Code:
With ActiveSheet.PivotTables("PivotTable2").PivotCache
.RefreshOnFileOpen = False
.MissingItemsLimit = xlMissingItemsDefault
End With
ActiveSheet.PivotTables("PivotTable2").RepeatAllLabels xlRepeatLabels
ActiveWorkbook.ShowPivotTableFieldList = True
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Team")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Type")
.Orientation = xlColumnField
.Position =1
End With
ActiveSheet.PivotTables("PivotTable2").AddDataField ActiveSheet.PivotTables( _
"PivotTable2").PivotFields("Type"), "Count of Type", _
xlCount