VBA Code

Properties and methods of the PivotTable object are used for manipulating the visual display of data within the pivottable on the worksheet
PivotTable fields can exist in one of four possible areas: row, column, page and data.


Pivot Tables can be used for:
1) import external data (eg from Access)
2) aggregating data




All the data in a Pivot table can be manipulated entirely using VBA.


Important Objects

PivotCaches - A collection of pivot cache objects in a workbook object.
PivotTables - A collection of pivot table objects in a worksheet object.
PivotTableFields - A collection of fields in a pivot table.
CreatePivotTable - Creates a pivot table using the data in a pivot cache. A PivotCache object method that creates a pivot table using the data in PivotCache.
PivotTableWizard - Creates a pivot table or modifies an existing pivot table. A worksheet object method that creates a pivot table.



PivotSelect Method

objPivotTable.PivotSelect(Name, Mode) 

Name - This is a string expression specifying which part of the pivot table
Mode - xlPTSelectionMode.



ActiveSheet.PivotTables(1).ListFormulas 
ActiveSheet.PivotTables(1).RefreshTable

ActiveSheet.PivotTables("-").TableRange1AutoFormat Format:=xlClassic3 




© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext