VBA to change Source Data for 1 series

Joined
Feb 8, 2002
Messages
3,381
Office Version
  1. 365
Platform
  1. Windows
I have a chart with three series.

Series 1 runs from A3:M3
Series 3 runs from A5:M5

Series 2 has to run from A4.Resize(1, x) where x changes each month.

What is the code to change just that one series?
SetSourceData affects the whole chart.

I am here in a room with only Excel 2007, where of course the macro recorder returns nothing.
Thanks in Advance!

Bill
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
This is the code the macro recorder produced when I changed the source for one range of a graph:

Code:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 16/11/2009 by Jaap
'
'
    ActiveSheet.ChartObjects("Chart 1").Activate
    ActiveChart.SeriesCollection(2).Select
    ActiveChart.SeriesCollection(2).Values = "=Sheet1!R8C5:R10C5"
End Sub

Does that help?
 
Upvote 0
Not really adding anything here to what sijpie said but you should be able to amend the series using:

Code:
Activechart.SeriesCollection(2).Value = Range("A4").ReSize(,x)
 
Upvote 0
Solution
Thanks.

That isn't quite doing it.

There are three series.
Series 1 is a column chart and always wants to show 12 months
Series 2 & 3 are line charts.
I want series 3 to show 12 points, but series 2 to only show the active point

(For a variety of reasons, we can not code #N/A into the future cells...)

Bill
 
Upvote 0
Richard...
Yes - that did it. Excellent. Thanks very much.

Bill
 
Upvote 0

Forum statistics

Threads
1,214,385
Messages
6,119,205
Members
448,874
Latest member
Lancelots

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top