R
Ribeye
Im trying to add a chart using a macro and I keep getting the following
message:
Method 'Add' of object 'sheets' failed error. What is wrong with the code
below?
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("C45:G45"),
PlotBy _
:=xlRows
ActiveChart.SeriesCollection(1).XValues = "=Sheet3!R1C2:R1C8"
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub
Thanks in advance for any help......
message:
Method 'Add' of object 'sheets' failed error. What is wrong with the code
below?
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("C45:G45"),
PlotBy _
:=xlRows
ActiveChart.SeriesCollection(1).XValues = "=Sheet3!R1C2:R1C8"
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub
Thanks in advance for any help......