Hi All,
This is my first post so go easy on me!
I have a selection of data which is being pulled out of a database into an excel spreadsheet.
I have set-up a recording of the macro (see below), but it is not pulling out any of the collum fields.
The row's pull out and set-up perfect every time, but the collum just produces one called "count".
Current code I am using:
If this isn't enough information let me know, I hope someone can help.
Thanks Tom
This is my first post so go easy on me!
I have a selection of data which is being pulled out of a database into an excel spreadsheet.
I have set-up a recording of the macro (see below), but it is not pulling out any of the collum fields.
The row's pull out and set-up perfect every time, but the collum just produces one called "count".
Current code I am using:
Code:
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Reg")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Name")
.Orientation = xlRowField
.Position = 2
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
Range("A4").Select
ActiveSheet.PivotTables("PivotTable2").CompactLayoutRowHeader = "Name"
Range("A3").Select
ActiveSheet.PivotTables("PivotTable2").DataPivotField.PivotItems( _
"Count of Type").caption = "Count of Behaviour"
Range("B3").Select
ActiveSheet.PivotTables("PivotTable2").CompactLayoutColumnHeader = _
"Behaviour Type"
Thanks Tom