Charting through VB.

  • Thread starter Thread starter Dunner
  • Start date Start date
D

Dunner

Hi,

I have run into a little problem while trying to update
charts using VB and was wondering if anyone can help.

Basically I have an excel 2000 workbook which is split
into several different sheets. The primary sheet is were
I am storing figures and the like and all the others are
charts which are built from these figures. Using VB I
have created a user form that takes the required
information places it in the the spreadsheet in the right
places and then - hopefully - updates the charts.

Unfortunately I can't get the charts to update with the
right data. So far I have tried using:

ActiveChart.SetSourceData Source:=Sheets("1").Range
("<requiredrange>"), PlotBy _
:=xlColumns

which works for the first graph (a4:b103) but doesn't for
the next as it plots two seperate series, one for column
B and one for column C. What I want to do is plot the
data in row A against the data in rows B-AC on the
different sheets (one sheet for each graph), all from
pressing a button on my VB userform. Can this be done and
if so how?

Thanks for your help.

Dunner
 
[This followup was posted to microsoft.public.excel.charting with an
email copy to Dunner.
Please use the newsgroup for further discussion.]

What does "required range" contain?

The foll. works just fine:

Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData _
Source:=Sheets("Sheet2").Range("A13:A15,C13:C15")
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet2"
 
Back
Top