View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Caroline Caroline is offline
external usenet poster
 
Posts: 183
Default SourceData for graph

If I use the following code, the CatTitle, ChartYear, SrcRange are graphed as
series.
I would like the CatTitle to be the title of the graph legend, the ChartYear
to be the Xaxis and the ScrRange the series to graph.
Can somebody help? thanks



Dim TheChartObj As ChartObject
Dim TheChart As Chart
Dim ChartYear As Range
Dim CatTitles As Range
Dim SrcRange As Range
Dim SourceData As Range

Set TheChartObj = ActiveSheet.ChartObjects(10)
Set TheChart = TheChartObj.Chart
Set SrcRange = Range(ActiveCell.Offset(0, 2), ActiveCell.Offset(0, 24))
Set ChartYear = Range("f3:ab3")
Set CatTitle = ActiveCell

Set SourceData = Union(CatTitle, ChartYear, SrcRange)

TheChart.SetSourceData _
Source:=SourceData, PlotBy:=xlRows

TheChartObj.Visible = True
--
caroline