Excel VBA - updating charts via pivot tables


I have a table in Excel that is automatically refreshed using code on opening the sheet.
The table is connected to a pivot table which is connected to a chart.
Errors occur because of these connections. Is there a way to get around this?
I tried to record the pivot table and chart generation but it was difficult because
you have first delete the existing ones and this gets messy
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
ragnarok89Connect With a Mentor Commented:
Try recalculating all sheets in the workbook. I assume your table, picot table, and cart are not all located on the same sheets.

For Each sh In ActiveWorkbook.Sheets
Next sh

or if you would prefer to specify which sheets get recalculated:


Use the above statement once for each sheet to be recalculated, where reference is the name of the sheet.
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
great worked. thanks
My pleasure
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.