Sub CreatePivotTable()
'
Range("A1").Select
Selection.CurrentRegion.Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
"'Raw Actual Data'!R1C1:R3286C6", TableDestination:="", TableName:= _
"PivotTable2"
ActiveSheet.PivotTables("PivotTable2").SmallGrid = False
ActiveSheet.PivotTables("PivotTable2").AddFields RowFields:=Array("Dept", _
"Natural Class B"" (GDE)""", "Dept2")
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Actuals")
.Orientation = xlDataField
.Name = "Sum of Actuals"
.Function = xlSum
End With
ActiveSheet.Name = "Actuals Pivot Table"
End Sub
|