ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set Source two Worksheets (https://www.excelbanter.com/excel-programming/393390-set-source-two-worksheets.html)

David

Set Source two Worksheets
 
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

Tom Ogilvy

Set Source two Worksheets
 
set the source to one of the ranges, then add a new series from the other.

--
Regards,
Tom Ogilvy


"David" wrote:

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


David

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

David

"Tom Ogilvy" wrote:

set the source to one of the ranges, then add a new series from the other.

--
Regards,
Tom Ogilvy


"David" wrote:

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


Tom Ogilvy

Set Source two Worksheets
 
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/P...cle.asp?ID=209
Charting FAQs

List of articles by Peltie
http://pubs.logicalexpressions.com/P...Search&AUTH=25

--
Regards,
Tom Ogilvy



"David" wrote:

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

David

"Tom Ogilvy" wrote:

set the source to one of the ranges, then add a new series from the other.

--
Regards,
Tom Ogilvy


"David" wrote:

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


David

Set Source two Worksheets
 
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

"Tom Ogilvy" wrote:

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/P...cle.asp?ID=209
Charting FAQs

List of articles by Peltier
http://pubs.logicalexpressions.com/P...Search&AUTH=25

--
Regards,
Tom Ogilvy



"David" wrote:

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

David

"Tom Ogilvy" wrote:

set the source to one of the ranges, then add a new series from the other.

--
Regards,
Tom Ogilvy


"David" wrote:

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



All times are GMT +1. The time now is 12:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com