X
Xavier
Hello,
I am facing difficulties to create a chart from a sheet containing empty
cells (I use Excel 2003 SP2). My sheet looks similar to this:
A B C
1 0.1
2 0.2 25 34
3 0.3 23 27
4 0.4 24 6
5 0.5 25 16
6 0.6 27 21
7 0.7
Column A contains data (some depth in my case). Each cell in column A
contains data. Column B and C contain some measurements made at the depth
indicated in column A. I need to combine two graphics on one chart: the
content of B in function of A and the content of C in function of A.
The following code works fine:
With Graph
.ChartType = xlLine
.SetSourceData Source:=Sheets(MainSheet).Range("B2:C6"),
PlotBy:=xlColumns
.SeriesCollection(1).XValues = Sheets(MainSheet).Range("A2:A6")
(...)
The result of this code is a chart containing two lines, for X values rangin
from 0.2 to 0.6. Now, what I really need is to have the X values ranging
from 0.1 to 0.7 and keep the lines displayed for values 0.2 -> 0.6. So I
change my code to:
With Graph
.ChartType = xlLine
.SetSourceData Source:=Sheets(MainSheet).Range("B1:C7"),
PlotBy:=xlColumns
.SeriesCollection(1).XValues = Sheets(MainSheet).Range("A1:A7")
(...)
And in this case, only ONE line is displayed (values of column C) ???
I have been working on this for two nights and this is driving me nuts.
Any help would be appreciated.
Thanks,
Xavier
I am facing difficulties to create a chart from a sheet containing empty
cells (I use Excel 2003 SP2). My sheet looks similar to this:
A B C
1 0.1
2 0.2 25 34
3 0.3 23 27
4 0.4 24 6
5 0.5 25 16
6 0.6 27 21
7 0.7
Column A contains data (some depth in my case). Each cell in column A
contains data. Column B and C contain some measurements made at the depth
indicated in column A. I need to combine two graphics on one chart: the
content of B in function of A and the content of C in function of A.
The following code works fine:
With Graph
.ChartType = xlLine
.SetSourceData Source:=Sheets(MainSheet).Range("B2:C6"),
PlotBy:=xlColumns
.SeriesCollection(1).XValues = Sheets(MainSheet).Range("A2:A6")
(...)
The result of this code is a chart containing two lines, for X values rangin
from 0.2 to 0.6. Now, what I really need is to have the X values ranging
from 0.1 to 0.7 and keep the lines displayed for values 0.2 -> 0.6. So I
change my code to:
With Graph
.ChartType = xlLine
.SetSourceData Source:=Sheets(MainSheet).Range("B1:C7"),
PlotBy:=xlColumns
.SeriesCollection(1).XValues = Sheets(MainSheet).Range("A1:A7")
(...)
And in this case, only ONE line is displayed (values of column C) ???
I have been working on this for two nights and this is driving me nuts.
Any help would be appreciated.
Thanks,
Xavier