To change chart data in a chart object grouped with a spinner i use following code, where an error occurs at the marked position. If i use curShape.select and then selection.setsourcedata... it works. Unfortunately in this case i have to manually unselect to be able to continue using the spinner. So how can i make excel to understand that curShape points to an chart object so that i can use the setsourcedata method?
Dim sheetname
Dim curShape As Shape
sheetname = "'" + Me.Name + "'!"
On Error GoTo GroupNotExisting
Set curShape = Me.Shapes("RemissionChartGroup")
On Error GoTo ChartNotExisting
Set curShape = curShape.GroupItems("Chart")
On Error GoTo UnableChangingSrcData
' *** Error occurs here !!! ***
curShape.SetSourceData _
Source:=Range(sheetname + "WLChartDataRange"), _
PlotBy:=xlColumns
|