Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Adding more series to a XY scatter chart

Hi, I am trying to make a XY scatter chart with Y error bars for each entry.
I have the code to collect three series for the chart, and also to draw the
chart and add the first series to it. However, I am not completely sure how
to add the next two series to the chart. If anyone could take a look at the
code and give me any suggestions I would be extremely gratefull. Thanks.

With ActiveSheet
lngLastRow1 = Sheets("Sheet2").Range("H65536").End(xlUp).Row
lngLastRow2 = Sheets("Sheet2").Range("I65536").End(xlUp).Row
lngLastRow3 = Sheets("Sheet2").Range("J65536").End(xlUp).Row
Set rngYValues1 = Sheets("Sheet2").Range("H1:H" & lngLastRow1)
Set rngXValues1 = Sheets("Sheet2").Range("B1:B" & lngLastRow1)
Set rngYValues2 = Sheets("Sheet2").Range("I" & lngLastRow1 + 1 &
":I" & lngLastRow2)
Set rngXValues2 = Sheets("Sheet2").Range("B" & lngLastRow1 + 1 &
":B" & lngLastRow2)
Set rngYValues3 = Sheets("Sheet2").Range("J" & lngLastRow2 + 1 &
":J" & lngLastRow3)
Set rngXValues3 = Sheets("Sheet2").Range("B" & lngLastRow2 + 1 &
":B" & lngLastRow3)
Set chtChart = .ChartObjects.Add(74, 68, 578, 293).Chart
End With

With chtChart
.ChartType = xlXYScatter
.SetSourceData rngYValues1, PlotBy:=xlColumns
.Axes(xlValue).MajorGridlines.Delete
.HasLegend = False
With .Axes(xlValue)
.MinimumScale = 0
.MaximumScale = UBound(arrScore) + 2
End With
With .Axes(xlCategory)
.MinimumScale = arrScore(LBound(arrScore)) - 2
.MaximumScale = arrScore(UBound(arrScore)) + 2
.TickLabels.NumberFormat = "0.00"
End With
With .SeriesCollection(1)
.XValues = rngXValues1
.ErrorBar Direction:=xlY, Include:=xlMinusValues,
Type:=xlCustom, MinusValues:="={100}"
End With
With .ChartGroups(1)
.Overlap = 0
.GapWidth = 10
.HasSeriesLines = False
.VaryByCategories = False
End With
End With


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Adding more series to a XY scatter chart

Graham -

You'll find some VBA charting techniques on this web page:

http://peltiertech.com/Excel/ChartsH...kChartVBA.html

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


"Graham Whitehead" wrote in message
...
Hi, I am trying to make a XY scatter chart with Y error bars for each
entry. I have the code to collect three series for the chart, and also to
draw the chart and add the first series to it. However, I am not
completely sure how to add the next two series to the chart. If anyone
could take a look at the code and give me any suggestions I would be
extremely gratefull. Thanks.

With ActiveSheet
lngLastRow1 = Sheets("Sheet2").Range("H65536").End(xlUp).Row
lngLastRow2 = Sheets("Sheet2").Range("I65536").End(xlUp).Row
lngLastRow3 = Sheets("Sheet2").Range("J65536").End(xlUp).Row
Set rngYValues1 = Sheets("Sheet2").Range("H1:H" & lngLastRow1)
Set rngXValues1 = Sheets("Sheet2").Range("B1:B" & lngLastRow1)
Set rngYValues2 = Sheets("Sheet2").Range("I" & lngLastRow1 + 1 &
":I" & lngLastRow2)
Set rngXValues2 = Sheets("Sheet2").Range("B" & lngLastRow1 + 1 &
":B" & lngLastRow2)
Set rngYValues3 = Sheets("Sheet2").Range("J" & lngLastRow2 + 1 &
":J" & lngLastRow3)
Set rngXValues3 = Sheets("Sheet2").Range("B" & lngLastRow2 + 1 &
":B" & lngLastRow3)
Set chtChart = .ChartObjects.Add(74, 68, 578, 293).Chart
End With

With chtChart
.ChartType = xlXYScatter
.SetSourceData rngYValues1, PlotBy:=xlColumns
.Axes(xlValue).MajorGridlines.Delete
.HasLegend = False
With .Axes(xlValue)
.MinimumScale = 0
.MaximumScale = UBound(arrScore) + 2
End With
With .Axes(xlCategory)
.MinimumScale = arrScore(LBound(arrScore)) - 2
.MaximumScale = arrScore(UBound(arrScore)) + 2
.TickLabels.NumberFormat = "0.00"
End With
With .SeriesCollection(1)
.XValues = rngXValues1
.ErrorBar Direction:=xlY, Include:=xlMinusValues,
Type:=xlCustom, MinusValues:="={100}"
End With
With .ChartGroups(1)
.Overlap = 0
.GapWidth = 10
.HasSeriesLines = False
.VaryByCategories = False
End With
End With



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
Multiple series in a scatter chart Viv Charts and Charting in Excel 10 October 16th 09 05:24 AM
scatter chart with gaps in series (XL 2007) Boris Charts and Charting in Excel 7 March 2nd 09 04:44 PM
Connecting two series in a scatter chart - Excel 2007 Tammy Charts and Charting in Excel 4 December 4th 08 02:21 PM
Create XY (Scatter) Chart, with 3 column (X, Y, Series) Ilka Charts and Charting in Excel 1 October 18th 07 05:19 PM
Series showing incorrectly on scatter chart Amy Charts and Charting in Excel 2 March 10th 07 09:39 PM


All times are GMT +1. The time now is 09:44 PM.

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"