Pivot Table

pratiksuhasaria

New Member
Joined
Mar 26, 2019
Messages
24
My aim is to insert multiple pivot tables on one sheet. but i cant do this as there are errors popping out.
Please help me this
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
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"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,713
Messages
6,174,039
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top