Set Source two Worksheets

D

David

How do I use SetSourceData to get information from two different worksheets?

I have two matching tables on two worksheets and I would like to be able to
chart similar data from the two sheets. eg.

Chart5.SetSourceData Source:=Sheets("ResultsIn").Range("D3:D15,E3:E15"), And _
Sheets("ResultsOut").Range("D3:D15,E3:E15"), _
PlotBy:=xlColumns

David
 
D

David

Thanks Tom, that was quick!
Sorry I'm still a little new though.
What is the code to add a series?

David
 
T

Tom Ogilvy

Slight modification of an example that was prevously posted by Jon Peltier:

With Worksheets("Review")
Set rngCht = .Range(.Cells(11, 7), .Cells(11, 24))
End With
With ActiveChart.SeriesCollection.NewSeries
.Name = Worksheets("Review").Cells(vX, 2)
.Values = rngCht
End With

You might want to check out some of his stuff if you do much Chart programming

John Peltier
http://peltiertech.com/

http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=209
Charting FAQs

List of articles by Peltie
http://pubs.logicalexpressions.com/Pub0009/LPMFrame.asp?CMD=ArticleSearch&AUTH=25
 
D

David

Thanks Tom they look good

The code worked too.

I put together the below code after looking through the list of objects and
checking out help on them. Are there any problems with using SeriesCollection
to do the same thing here?

ActiveChart.SeriesCollection.Add
Source:=Worksheets("ResultsOut").Range(ChartRange)

David
 

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