Jenst
09-23-2016, 03:56 AM
Hi guys,
I want to create a pivot table without directly pointing out the names of the Pivot Fields, instead I want to refer to the cell value.
Has anyone an idea how to do it??
Range("A1:BQ22").Select
Range("J8").Activate
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
Sheets("DATA").Range("A1").CurrentRegion, Version:=xlPivotTableVersion14).CreatePivotTable _
TableDestination:="Sheet2!R20C1", TableName:="PivotTable2", DefaultVersion _
:=xlPivotTableVersion14
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields(Cells(2, 28).Value), "Average" & Cells(2, 28).Value, xlAverage
:thumb
Thanks for your help!
Step
I want to create a pivot table without directly pointing out the names of the Pivot Fields, instead I want to refer to the cell value.
Has anyone an idea how to do it??
Range("A1:BQ22").Select
Range("J8").Activate
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
Sheets("DATA").Range("A1").CurrentRegion, Version:=xlPivotTableVersion14).CreatePivotTable _
TableDestination:="Sheet2!R20C1", TableName:="PivotTable2", DefaultVersion _
:=xlPivotTableVersion14
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields(Cells(2, 28).Value), "Average" & Cells(2, 28).Value, xlAverage
:thumb
Thanks for your help!
Step