Complete the code to create a PivotTable from the data in Sheet1.
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Sheets("Sheet1").Range([1])).CreatePivotTable TableDestination:=Sheets("Sheet2").Range("A3"), TableName:="SalesPivot"
The range "A1:D100" covers the full data table for the PivotTable source.
Complete the code to add a row field named "Region" to the PivotTable.
With Sheets("Sheet2").PivotTables("SalesPivot") .PivotFields([1]).Orientation = xlRowField End With
"Region" is the field to be added as a row in the PivotTable.
Fix the error in the code to add a data field summing the "Sales" column.
With Sheets("Sheet2").PivotTables("SalesPivot") .AddDataField .PivotFields([1]), "Total Sales", xlSum End With
"Sales" is the correct field name to sum in the data field.
Fill both blanks to filter the PivotTable to show only "East" region data.
With Sheets("Sheet2").PivotTables("SalesPivot") .PivotFields([1]).ClearAllFilters .PivotFields([2]).CurrentPage = "East" End With
Filtering is applied on the "Region" field to show only "East" data.
Fill all three blanks to group the PivotTable dates by months and years.
With Sheets("Sheet2").PivotTables("SalesPivot") .PivotFields([1]).Orientation = xlColumnField .PivotFields([2]).Group Periods:=Array([3]) End With
The "Date" field is set as a column field and grouped by months.
