Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Help setting chart series values with non-continuous range

I am trying to create a chart with multiple series and each series having
values from non-continuous ranges. Can someone help by explaining why this
doesn't work or what I should do instead.

Charts.Add
ActiveChart.ChartType = xlLineMarkers
With ActiveChart.SeriesCollection.NewSeries
.Name = Worksheets("Review").Cells(vX, 2)
.Values = Union(Range(Worksheets("Review").Cells(11, 7),
Worksheets("Review").Cells(11, 24)), Range(Worksheets("Review").Cells(50,
25), Worksheets("Review").Cells(50, 61)))
End With

I found the Uniton on this forum and it works for
ActiveChart.SetSourceData Source:=
But I need to do multiple series.

Thanks,
John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Help setting chart series values with non-continuous range

Have you thought about defining a non contiguous named range and then
applying that to the series?

"John Hutcins" wrote:

I am trying to create a chart with multiple series and each series having
values from non-continuous ranges. Can someone help by explaining why this
doesn't work or what I should do instead.

Charts.Add
ActiveChart.ChartType = xlLineMarkers
With ActiveChart.SeriesCollection.NewSeries
.Name = Worksheets("Review").Cells(vX, 2)
.Values = Union(Range(Worksheets("Review").Cells(11, 7),
Worksheets("Review").Cells(11, 24)), Range(Worksheets("Review").Cells(50,
25), Worksheets("Review").Cells(50, 61)))
End With

I found the Uniton on this forum and it works for
ActiveChart.SetSourceData Source:=
But I need to do multiple series.

Thanks,
John

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Help setting chart series values with non-continuous range

I can't say this is the best way, but it worked for me:

Sub AAA()
Dim vx as Long, sh as Worksheet
vx = 1
Charts.Add
ActiveChart.ChartType = xlLineMarkers
Set sh = Worksheets("Review")
With ActiveChart.SeriesCollection.NewSeries
.Name = sh.Cells(vx, 2)
.Formula = "=SERIES(,,(" & sh.Range( _
sh.Cells(11, 7), _
sh.Cells(11, 24)) _
.Address(1, 1, xlA1, True) & "," & _
sh.Range(sh.Cells(50, 25), _
sh.Cells(50, 61)) _
.Address(1, 1, xlA1, True) & "),1)"
End With
End Sub

--
Regards,
Tom Ogilvy


"John Hutcins" wrote:

I am trying to create a chart with multiple series and each series having
values from non-continuous ranges. Can someone help by explaining why this
doesn't work or what I should do instead.

Charts.Add
ActiveChart.ChartType = xlLineMarkers
With ActiveChart.SeriesCollection.NewSeries
.Name = Worksheets("Review").Cells(vX, 2)
.Values = Union(Range(Worksheets("Review").Cells(11, 7),
Worksheets("Review").Cells(11, 24)), Range(Worksheets("Review").Cells(50,
25), Worksheets("Review").Cells(50, 61)))
End With

I found the Uniton on this forum and it works for
ActiveChart.SetSourceData Source:=
But I need to do multiple series.

Thanks,
John

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Help setting chart series values with non-continuous range

In general:

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

but Excel doesn't let you use a range that isn't a single row or a single
column for values, and your values are in rows 11 and 50. I generally prefer
to work with .Values and .XValues than with the series .Formula, but here
it's unavoidable. Use Tom's procedure.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______



"John Hutcins" wrote in message
...
I am trying to create a chart with multiple series and each series having
values from non-continuous ranges. Can someone help by explaining why
this
doesn't work or what I should do instead.

Charts.Add
ActiveChart.ChartType = xlLineMarkers
With ActiveChart.SeriesCollection.NewSeries
.Name = Worksheets("Review").Cells(vX, 2)
.Values = Union(Range(Worksheets("Review").Cells(11, 7),
Worksheets("Review").Cells(11, 24)), Range(Worksheets("Review").Cells(50,
25), Worksheets("Review").Cells(50, 61)))
End With

I found the Uniton on this forum and it works for
ActiveChart.SetSourceData Source:=
But I need to do multiple series.

Thanks,
John



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Help setting chart series values with non-continuous range

Thanks, this did it for me! Although, I had to move the .Name = declaration
to after .Formula = . For some reason it would take the name assigment after
but not before.. Either way that got it done, thanks. I may also try the
Set rngCht = suggested by Jon to set the value instead of the formula.

Always greate help here!

"Tom Ogilvy" wrote:

I can't say this is the best way, but it worked for me:

Sub AAA()
Dim vx as Long, sh as Worksheet
vx = 1
Charts.Add
ActiveChart.ChartType = xlLineMarkers
Set sh = Worksheets("Review")
With ActiveChart.SeriesCollection.NewSeries
.Name = sh.Cells(vx, 2)
.Formula = "=SERIES(,,(" & sh.Range( _
sh.Cells(11, 7), _
sh.Cells(11, 24)) _
.Address(1, 1, xlA1, True) & "," & _
sh.Range(sh.Cells(50, 25), _
sh.Cells(50, 61)) _
.Address(1, 1, xlA1, True) & "),1)"
End With
End Sub

--
Regards,
Tom Ogilvy


"John Hutcins" wrote:

I am trying to create a chart with multiple series and each series having
values from non-continuous ranges. Can someone help by explaining why this
doesn't work or what I should do instead.

Charts.Add
ActiveChart.ChartType = xlLineMarkers
With ActiveChart.SeriesCollection.NewSeries
.Name = Worksheets("Review").Cells(vX, 2)
.Values = Union(Range(Worksheets("Review").Cells(11, 7),
Worksheets("Review").Cells(11, 24)), Range(Worksheets("Review").Cells(50,
25), Worksheets("Review").Cells(50, 61)))
End With

I found the Uniton on this forum and it works for
ActiveChart.SetSourceData Source:=
But I need to do multiple series.

Thanks,
John

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Named range not continuous. How to display values? Fries Excel Worksheet Functions 4 May 29th 08 11:41 AM
VBA - Setting up a Chart series C Brandt Excel Discussion (Misc queries) 4 August 6th 07 10:03 PM
Read series values range of a chart matelot Charts and Charting in Excel 2 May 15th 07 03:45 AM
Setting Excel chart series from vb6 Jim Charts and Charting in Excel 7 January 27th 06 09:41 AM
Setting Chart series BJ Excel Programming 0 January 17th 05 10:51 AM


All times are GMT +1. The time now is 01:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"