I'm trying to delete a series via VBA before populating it again. I protected the sheet and with the option UserInterfaceOnly=True and the chart is set to locked. the protection of the cells works fine and I can still change their value via VBA, but it doesn't work for the chart. If I try to delete the series I get the error message Ron-time error 1004
The cell or chart you are trying to change is portected and therefore read-only. The debugger than jumps into the row with the delete.
Worksheets(1).EnableSelection = xlUnlockedCells
Worksheets(1).Protect Password:="x", UserInterfaceOnly:=True
With ActiveSheet.ChartObjects(1).Chart
For Each x In .SeriesCollection
x.Delete
Next x
any ideas?
Thanks
Peter
The cell or chart you are trying to change is portected and therefore read-only. The debugger than jumps into the row with the delete.
Worksheets(1).EnableSelection = xlUnlockedCells
Worksheets(1).Protect Password:="x", UserInterfaceOnly:=True
With ActiveSheet.ChartObjects(1).Chart
For Each x In .SeriesCollection
x.Delete
Next x
any ideas?
Thanks
Peter