vba excel = Column values are not coming as column headings in pivot table

Abhijeet Kadam 1 Reputation point

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.

team type
bb not operation
aa operation
bb not operation

team not operation operation
bb 2
aa 1

    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", _
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,658 questions
0 comments No comments
{count} votes