excel macro does not

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

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

Excel Macro does not work

resolvedResolved · Low Priority · Version 365

Letizia has attended:
Excel VBA Introduction 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:

Go to source of a cell

The default setting in Excel is when you double click in a cell it actives the formula in the cell. If you have created a link and want to directly go to that link (say if on another sheet, click on Tools -options and take off the tick for eidt it directly in cell

View all Excel hints and tips


Server loaded in 0.07 secs.