Letizia has attended:
Excel VBA Introduction course
Power BI Reporting course
Excel Macro does not work
I try to run the macro and it does not work - this is what gets highlighted
ActiveWorkbook.Worksheets("not counted").PivotTables("PivotTable1").PivotCache. _
CreatePivotTable TableDestination:="not counted", TableName:="PivotTable1" _
, DefaultVersion:=7
Thank you!
RE: Excel Macro does not work
Hi Letizia,
Thank you for the forum question.
My best guess is that the problem is:
TableName:="PivotTable1"
When you record you create a PivotTable. Excel give the PivotTable a name. Here PivotTable1. If you run the macro again Excel try to name the new PivotTable exactly what it is called in the macro here PivotTable1. You cannot have two PivotTables in the same Excel file with the same name.
Try to run your macro in another Excel file with no PivotTable to see if it is a name issue.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector