I added a series to a chart and recorded as a Macro. The following VBA was recorded:
Sub Macro2()
'
' Macro2 Macro
'
ActiveChart.ChartArea.Select
ActiveChart.PlotArea.Select
Application.CutCopyMode = False
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection(6).Name = "=""XXX"""
ActiveChart.FullSeriesCollection(6).Values = "=Goal2!$P$120:$P$3929"
End Sub
I deleted the series and ran the VBA recorded to test it, and it worked fine.
I then deleted the series again, and put a breakpoint at the "End Sub" line, and ran the Macro to the breakpoint at the end.
In the VBA immediate window, I did the following:
?activechart.FullSeriesCollection(6).name
XXX
?Activechart.FullSeriesCollection(6).values
[Runtime Error 13, Type Mismatch]
<runtime error="" 13,="" type="" mismatch"="">
As you see the query for the Name worked fine and returned the correct name, "XXX".
The query for the "Values" property gives "Run time error 13, type mismatch".
How can i fetch the "Values" property for an item of a FullSeriesCollection? Ultimately, I want to, within VBA code, get the string from the "Values" property, manipulate it, and then re-set the property to the new value after i manipulate it.
Any help is appreciated.
Thank you!</runtime>
Sub Macro2()
'
' Macro2 Macro
'
ActiveChart.ChartArea.Select
ActiveChart.PlotArea.Select
Application.CutCopyMode = False
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection(6).Name = "=""XXX"""
ActiveChart.FullSeriesCollection(6).Values = "=Goal2!$P$120:$P$3929"
End Sub
I deleted the series and ran the VBA recorded to test it, and it worked fine.
I then deleted the series again, and put a breakpoint at the "End Sub" line, and ran the Macro to the breakpoint at the end.
In the VBA immediate window, I did the following:
?activechart.FullSeriesCollection(6).name
XXX
?Activechart.FullSeriesCollection(6).values
[Runtime Error 13, Type Mismatch]
<runtime error="" 13,="" type="" mismatch"="">
As you see the query for the Name worked fine and returned the correct name, "XXX".
The query for the "Values" property gives "Run time error 13, type mismatch".
How can i fetch the "Values" property for an item of a FullSeriesCollection? Ultimately, I want to, within VBA code, get the string from the "Values" property, manipulate it, and then re-set the property to the new value after i manipulate it.
Any help is appreciated.
Thank you!</runtime>