Share via

when i do run that code error is showing run time error 1004:-a pivot report cannot overloap a table

Anonymous
2024-11-28T04:25:28+00:00

Sub NORTHPVT()

'

' NORTHPVT Macro

'

'

Sheets.Add 

ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= \_ 

    "Table2", Version:=6).CreatePivotTable TableDestination:="Sheet3!R3C1", \_ 

    TableName:="PivotTable6", DefaultVersion:=6 

Sheets("Sheet3").Select 

Cells(3, 1).Select 

With ActiveSheet.PivotTables("PivotTable6").PivotFields("Zone") 

    .Orientation = xlPageField 

    .Position = 1 

End With 

ActiveSheet.PivotTables("PivotTable6").PivotFields("Zone").ClearAllFilters 

ActiveSheet.PivotTables("PivotTable6").PivotFields("Zone").CurrentPage = \_ 

    "NORTH 1" 

With ActiveSheet.PivotTables("PivotTable6").PivotFields("Market") 

    .Orientation = xlRowField 

    .Position = 1 

End With 

With ActiveSheet.PivotTables("PivotTable6").PivotFields( \_ 

    "Market Head / City Head NAME ") 

    .Orientation = xlRowField 

    .Position = 2 

End With 

ActiveSheet.PivotTables("PivotTable6").AddDataField ActiveSheet.PivotTables( \_ 

    "PivotTable6").PivotFields("YTD mandates FY 24-25"), \_ 

    "Sum of YTD mandates FY 24-25", xlSum 

ActiveSheet.PivotTables("PivotTable6").AddDataField ActiveSheet.PivotTables( \_ 

    "PivotTable6").PivotFields("YTD Accounts FY 24-25"), \_ 

    "Sum of YTD Accounts FY 24-25", xlSum 

ActiveSheet.PivotTables("PivotTable6").AddDataField ActiveSheet.PivotTables( \_ 

    "PivotTable6").PivotFields("YTD Accounts FY 23-24"), \_ 

    "Sum of YTD Accounts FY 23-24", xlSum 

ActiveCell.Offset(13, 1).Range("A1").Select 

ActiveSheet.PivotTables("PivotTable6").RowAxisLayout xlTabularRow 

ActiveCell.Offset(-9, -1).Range("A1").Select 

ActiveSheet.PivotTables("PivotTable6").PivotFields("Market").Subtotals = Array( \_ 

    False, False, False, False, False, False, False, False, False, False, False, False) 

End Sub

* Changed to a question

Microsoft 365 and Office | Install, redeem, activate | Other | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-11-30T05:30:31+00:00

    Hi, Rohit Rambir Singh Thank you for using Microsoft products and posting them to the community.

    We understand the issue you are experiencing. Unfortunately, VBA is not supported on the Microsoft Answers forum. It is more suitable for publishing on Stack Overflow  (English only). Post VBA programming questions to Stack Overflow by using the vba tag, along with any other relevant tags.Please note that Stack Overflow has guidelines such as requiring a descriptive title, a complete and concise problem statement, and sufficient details to reproduce your issue. Feature requests or overly broad questions are considered off-topic.Disclaimer: Microsoft provides no assurances and/or warranties, implied or otherwise, and is not responsible for the information you receive from the third-party linked sites or any support related to technology.I won't be able to help you, but I'll leave that question open in case one of our amazing volunteers has ideas for you.

    I hope the above information can help you. Feel free to send a message if you need further help.

    Best wishes

    Aiden.C - MSFT |Microsoft Community Support Specialist

    Was this answer helpful?

    0 comments No comments