Re: Using offset in series values of a chart
- From: "Jon Peltier" <jonxlmvpNO@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 10 Oct 2007 13:50:32 -0400
You have to create one named range for each set of Y values.
For your charts, if you are making it with VBA, just accept the selected
range from the user, use the first column as the X values, and use each
subsequent column for each series.
' air code
Dim rData As Range
Dim iCol As Long
Dim iChart As Chart
Set rData = Selection
Set oChart = Active***.ChartObjects.Add(100, 100, 350, 275).Chart
Do While oChart.SeriesCollection.Count > 0
oChart.SeriesCollection(1).Delete
Loop
For iCol = 1 To rData.Columns.Count - 1
With oChart.SeriesCollection.NewSeries
.Values = rData.Columns(iCol + 1)
.XValues = rData.Columns(1)
End With
Next
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______
"Beertje" <Beertje@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C182591F-6B7A-404E-9CB5-3A0CB311101E@xxxxxxxxxxxxxxxx
I have 1 named range created with the offset function on ***(1):
Month=offset($A$1,0,0,counta($A:$A),1)
Simple to use as the x-as categories in a chart.
For the y-axis I want to use data which can be offset 1, 2, up to 20
columns.
Yes I can create 20 named ranges but to do that for 20 sheets in my
workbook
gets cumbersome.
Therefor my question:
Can I use the offset function in the series values, like:
=offset(Month,0,7)
In VBA it it can be done with:
.SeriesCollection(2).Values = Month.Offset(0, 17)
But then I have to create one macro for each graph...again cumbersome.
Please help.
Thx.
Beertje.
.
- Prev by Date: Re: category Axis
- Next by Date: Re: Trendlines
- Previous by thread: Re: Dates in Excel 2007 graph axis dialogs - thanks
- Next by thread: 2D Chart - x scale label displays wrong
- Index(es):