Charting through VB.

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
 
T

Tushar Mehta

[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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top