×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Create Chart with multiple collections definde by cells

Create Chart with multiple collections definde by cells

Create Chart with multiple collections definde by cells

(OP)
Hello,
I am trying to create a chart with many plots and would like to do something similar to the code below.

Sub Macro1()
'
Dim R1, R2, R3, R4, R5, R6, R7 As Range
Dim RR(11) As Range
Sheet2.Select
For i = 0 To 11
Set RR(i) = Range(Cells(9, 2 + 9 * i), Cells(209, 2 + 9 * i))
Next i
'
Range(RR(0),RR(1),RR(2),RR(3),RR(4),RR(5),RR(6),RR(7),RR(8),RR(9),RR(10),RR(11)).Select


ActiveSheet.Shapes.AddChart2(240, xlXYScatterLinesNoMarkers).Select
ActiveChart.SetSourceData Source:=Range(RR(0),RR(1),RR(2))
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection(1).Name = CELLS(8,2)
ActiveChart.FullSeriesCollection(1).XValues = RR(0)
ActiveChart.FullSeriesCollection(1).Values =RR(1)
FOR I=2 TO 11
ActiveChart.FullSeriesCollection(I).Name = CELLS(8,2 + 9 * i)
ActiveChart.FullSeriesCollection(I).XValues = RR(0)
ActiveChart.FullSeriesCollection(I).Values =RR(I)
NEXT I
End Sub

Please advise

Thank you

RE: Create Chart with multiple collections definde by cells

Hi,

What problems are you experiencing with your code and/or with your chart result?

Plz upload representative sample source data with 12 columns of data.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Create Chart with multiple collections definde by cells

(OP)
well, for starters, it just fails on

Range(RR(0),RR(1),RR(2),RR(3),RR(4),RR(5),RR(6),RR(7),RR(8),RR(9),RR(10),RR(11)).Select

what I am trying to do is defining an ARRAY of ranges, so I can use the definitions of the series collections in a loop (using the cells method)

RE: Create Chart with multiple collections definde by cells

Try Union instead of Range.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Create Chart with multiple collections definde by cells

(OP)
Thanks, I passed that line.

Now it fails on

ActiveChart.SetSourceData Source:=Range(RR(0), RR(1), RR(2))

I do not know how to proceed with the "Union"

Thanks

RE: Create Chart with multiple collections definde by cells

Quote:

I do not know how to proceed with the "Union"

What does that mean?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Create Chart with multiple collections definde by cells

This code loads the chart with the data you selected.

CODE

'
    Union(RR(0), RR(1), RR(2), RR(3), RR(4), RR(5), RR(6), RR(7), RR(8), RR(9), RR(10), RR(11)).Select

    ActiveSheet.Shapes.AddChart 240, xlXYScatterLinesNoMarkers 

Is that what you intended?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

White Paper - The Criticality of the E/E Architecture
Modern vehicles are highly sophisticated systems incorporating electrical, electronic, software and mechanical components. Mechanical systems are giving way to advanced software and electronic devices, driving automakers to innovate and differentiate their vehicles via the electric and electronic (E/E) architecture. As the pace of change accelerates, automotive companies need to evolve their development processes to deliver and maximize the value of these architectures. Download Now
White Paper - Model Based Engineering for Wire Harness Manufacturing
Modern cars, trucks, and other vehicles feature an ever-increasing number of sophisticated electrical and electronic features, placing a larger burden on the wiring harness that enables these new features. As complexity rises, current harness manufacturing methods are struggling to keep pace due to manual data exchanges and the inability to capture tribal knowledge. A model-based wire harness manufacturing engineering flow automates data exchange and captures tribal knowledge through design rules to help harness manufacturers improve harness quality and boost efficiency. Download Now
White Paper - Modeling and Optimizing Wire Harness Costs for Variation Complexity
This paper will focus on the quantification of the complexity related costs in harness variations in order to model them, allowing automated algorithms to optimize for these costs. A number of real world examples will be provided as well. Since no two businesses are alike, it is the aim of this paper to provide the foundational knowledge and methodology so the reader can assess their own business to model how variation complexity costs affect their business. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close