acidburn170
New Member
- Joined
- Feb 20, 2018
- Messages
- 1
Hello,
I am using Excel 2007 and have a protected sheet containing a macro within that sheet. I want the macro to change the data and it does so when the sheet is unprotected. Once I protect it, I am getting this error - Method 'Name' of object 'Series' failed.
How could I fix this macro so that it runs when worksheet is protected?
Thank you!
I am using Excel 2007 and have a protected sheet containing a macro within that sheet. I want the macro to change the data and it does so when the sheet is unprotected. Once I protect it, I am getting this error - Method 'Name' of object 'Series' failed.
How could I fix this macro so that it runs when worksheet is protected?

Code:
Sub COIAspen()'
' Aspen Macro
'
' ActiveSheet.Unprotect "TEST"
ActiveSheet.ChartObjects("Chart 5").Activate
ActiveSheet.ChartObjects("Chart 5").Activate
[B] ActiveChart.SeriesCollection(1).Name = "='YEAR-TO-DATE FOR 2018'!$B$20"[/B]
ActiveChart.SeriesCollection(1).Values = "='YEAR-TO-DATE FOR 2018'!$C$20:$N$20"
ActiveSheet.Protect "TEST"
End Sub
Thank you!