Pivot - Using VBA
Pivot - Using VBA
PROCESS
Split the process of creating a Pivot Table into below given steps
Declare Variables
Insert a New Worksheet
Define Data Range
Create Pivot Cache
Insert a Blank Pivot Table
Insert Row & Column Fields
Insert Data Fields
FormatPivot Table
'Declare Variables
Dim PSheet As Worksheet
Dim DSheet As Worksheet
Dim PCache As PivotCache
Dim PTable As PivotTable
Dim PRange As Range
Dim LastRow As Long
Dim LastCol As Long