jondavis1987
Active Member
- Joined
- Dec 31, 2015
- Messages
- 443
- Office Version
- 2019
- Platform
- Windows
So i recorded a macro for what I am trying to do. I have a worksheet called Superpave Template. I regularly have to create add a new sheet to the book and copy everything from the superpave template into the new sheet. The problem is the chart doesn't update automatically to the new sheet. It still pulls from the Superpave Template. That's what all of this is trying to do. keep getting an error on the line that i put asterisks on. The error code says object with specified name can't be found
VBA Code:
Option Explicit
Sub New_Superpave()
'
' New_Superpave Macro
'
'
Sheets.Add After:=ActiveSheet
Sheets("Superpave Template").Select
Cells.Select
Selection.Copy
Sheets("Sheet3").Select
ActiveSheet.Buttons.Add(891.75, 63, 91.5, 30).Select
ActiveSheet.Paste
* ActiveSheet.ChartObjects("Chart 1").Activate *
ActiveChart.PlotArea.Select
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
Application.CutCopyMode = False
ActiveChart.FullSeriesCollection(1).Values = "=Sheet3!$L$9:$L$19"
ActiveChart.FullSeriesCollection(2).Values = "=Sheet3!$M$9:$M$19"
ActiveChart.FullSeriesCollection(3).Values = "=Sheet3!$O$9:$O$19"
ActiveChart.FullSeriesCollection(4).Values = "=Sheet3!$P$9:$P$19"
End Sub