View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] es330td@gmail.com is offline
external usenet poster
 
Posts: 7
Default VBA chart problem

I have a Excel app that is supposed to include a chart. The data
consists of three columns; a month number, a cumulative projected
budget and cumulative actual expenditures

1 2000 1982
2 4000 4023
3 7000 6995
4 8000
5 11000
6 11500

I am trying to make a chart with two series; one will be the projected
budget, the other the actual expenditures. The actual line should
track the projected line for whatever actual data exists then the
projected line should continue through its data points.

This is the code I wrote trying to generate this chart:

Worksheets("PR Cashflow").Activate
Set crt = ActiveSheet.ChartObjects.Add(475, 40, 520, 300)
crt.Chart.ChartType = xlLineMarkersStacked
crt.Chart.PlotBy = xlColumns

With crt.Chart.SeriesCollection.NewSeries
.Values = ActiveSheet.range("AB5:AB13")
.XValues = ActiveSheet.range("AA5:AA13")
End With

With crt.Chart.SeriesCollection.NewSeries
.Values = ActiveSheet.range("AC5:AC8")
.XValues = ActiveSheet.range("AA5:AA13")
End With

Here is the problem I am having: when it adds the second series to the
chart it appears as though the y axis values are getting added so
instead of the first data points being 1,2000 and 1,1982 it looks like
they are 1,2000 and 1,3982

What am I missing here?