ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ChartCalculate code causing error when saving workbook (https://www.excelbanter.com/excel-programming/291880-chartcalculate-code-causing-error-when-saving-workbook.html)

Pete McCosh[_5_]

ChartCalculate code causing error when saving workbook
 
All,

I would appreciate any advice you could shed on this. I
have a workbook which contains a number of pivot tables
based on data in a second, external workbook. I have the
undernoted code in the ChartCalculate event of a
pivotchart in this book to get round the series formats
going back to default when you pivot on the chart. When I
try to save the workbook I get "Run time error 91 - Object
or With block variable not set" message and the debugger
takes me to the For.. line of this code.

It's not a major problem as the purpose of the worksheet
is for users to be able to interrogate a larger data set
without being able to alter it in any way, so they should
have no real need to save it. However, it's still annoying
for me!

The code is as follows:

Private Sub Chart_Calculate()
Dim X As Integer
Application.ScreenUpdating = False
For X = 1 To ActiveChart.SeriesCollection.Count
With ActiveChart.SeriesCollection(X)
.MarkerSize = 7
.Border.Weight = xlMedium
End With
Next X
Application.ScreenUpdating = True
End Sub

Your suggestions are eagerly anticipated.

Pete.


All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com