VBA - Pivot table - Create multiple data columns in pvt table from single data source column

drsudhakar

New Member
Joined
Jan 25, 2018
Messages
6
Dear all

I want to generate multiple columns in Pivot table from single data column with each data type as a column header. I could do pivot table, but not sure how to proceed on this.



'Insert Row Fields
With ActiveSheet.PivotTables("PT1").PivotFields("username")
.Orientation = xlRowField
.Position = 1
End With


With ActiveSheet.PivotTables("PivotTable4").PivotFields("CTypeDesc")
.Orientation = xlRowField
.Position = 2
End With


'Insert column Fields
With ActiveSheet.PivotTables("PT1").PivotFields("CTypeDesc")
.Orientation = xlPageField
.Position = 2
End With
With ActiveSheet.PivotTables("PT1").PivotFields("CTypeDesc")
.Orientation = xlColumnField
.Position = 1
End With


'Insert Data Field
ActiveSheet.PivotTables("PT1").AddDataField ActiveSheet.PivotTables( _
"PT1").PivotFields("CTypeDesc"), "Count of CTypeDesc", _
xlCount


I am amateur in VBA. I am hopeful, if somebody could kindly help. Thanks in advance for your time and help.



regards
drsudhakar
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top