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

link - learn.microsoft.com/en-us/previous-versions/office/developer/office-2010/hh243933(v=office.14) 
link - learn.microsoft.com/en-us/previous-versions/office/developer/office-2007/ff536099(v=office.12)

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("-").TableRange1AutoFormat Format:=xlClassic3 

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