I am trying to dynamically set a chart object source. The fdc and ldc variables will change over time. I've tried several variations of code; my latest attempt being:
fdc = 26
ldc = 90
ws.ChartObjects("Chart 2").SetSourceData Source:=ws.Range("S" & fdc & ":V" & ldc)
but they all give:
Run-time error '438': Object doesn't support this property or method.
You're referring to the ChartObject. SetSourceData
is a method of the Chart
inside the ChartObject
.
Try
fdc = 26
ldc = 90
ws.ChartObjects("Chart 2").Chart.SetSourceData Source:=ws.Range("S" & fdc & ":V" & ldc)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.