Sub MakePivots()
Dim DataRange As Range
Dim Destination, Destination2 As Range
' set data range for pivot tables
Set DataRange = Worksheets("MF_GA_LT").Range("A1:AA25")
'set destination for 1st pivot table
Set Destination = Sheets("PT").Range("A11")
'create 1st pivot table
Worksheets("MF_GA_LT").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, _
SourceData:=DataRange, TableDestination:=Destination, TableName:="PT1"
'add row and data fields
With Sheets("PT").PivotTables("PT1")
.PivotFields("BOL:Business Object ID").Orientation = xlRowField
.PivotFields("Extraction completed Baseline").Orientation = xlDataField
End With
'set destination for second pivot table
Set Destination2 = Sheets("PT").Range("H11")
'create second pivot table - destination and name are differnet to 1st pivot table
Worksheets("MF_GA_LT").Select
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, _
SourceData:=DataRange, TableDestination:=Destination, TableName:="PT2"
'add row and data fields for 2nd pivot table
With Sheets("PT").PivotTables("PT2")
.PivotFields("BOL:Business Object ID").Orientation = xlRowField
.PivotFields("Transformation completed Baseline").Orientation = xlDataField
End With
End Sub
I m getting an error quoting " Run-Time Error '1004': A Pivot Report cannot overlap another pivot report"