PC Review Forums Newsgroups Microsoft Excel Microsoft Excel Charting Charting through VB.

Reply

Charting through VB.

 
Thread Tools Rate Thread
Old 02-07-2003, 10:53 AM   #1
Dunner
Guest
 
Posts: n/a
Default Charting through VB.


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
  Reply With Quote
Old 02-07-2003, 07:26 PM   #2
Tushar Mehta
Guest
 
Posts: n/a
Default Re: Charting through VB.

What does "required range" contain?

The foll. works just fine:

--
Regards,

Tushar Mehta (www.tushar-mehta.com) MS MVP -- Excel

In article <085001c34088$34890230$a501280a@phx.gbl>,
martindunne@bankofscotlandint.com says...
> 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
>

  Reply With Quote
Old 02-07-2003, 07:27 PM   #3
Tushar Mehta
Guest
 
Posts: n/a
Default Re: Charting through VB.

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

--
Regards,

Tushar Mehta (www.tushar-mehta.com) MS MVP -- Excel

In article <085001c34088$34890230$a501280a@phx.gbl>,
martindunne@bankofscotlandint.com says...
> 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
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off