Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

excel macro does not

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Excel Macro does not work

Excel Macro does not work

ResolvedVersion 365

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

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Quick Zooming in Excel with rollerball mouses

To zoom in and out of your page hold down the control key and roll the wheel up and down. This will zoom up and down 15% at a time.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.