Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Newseries; macro to code

Like a lot of stuff I do the macro thing first to get a general idea
of the landscape. Here I'm up against the limits of my ability.

This has been working just fine for a while

myChart.SeriesCollection.NewSeries
myChart.SeriesCollection(2).Values = "='HCLHotBath'!
R75C107:R75C250"
myChart.SeriesCollection(2).Name = "B2Alpha"

Now, all of a sudden it bombs on the .Name =, the message is

"Unable to set the Name property of the Series Class"

I have this feeling that SeriesCollection(2) really isn't there. But,
on the other hand, the values plotted. I can see it. I would think
there would be a way to create a series object and THEN add it to the
chart somehow.

(Seems a little flaky to rely on NewSeries returning the "next"
number. What if someone altered the code above later.)

Thank you.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Newseries; macro to code


cate;591297 Wrote:
Like a lot of stuff I do the macro thing first to get a general idea
of the landscape. Here I'm up against the limits of my ability.

This has been working just fine for a while

myChart.SeriesCollection.NewSeries
myChart.SeriesCollection(2).Values = "='HCLHotBath'!
R75C107:R75C250"
myChart.SeriesCollection(2).Name = "B2Alpha"

Now, all of a sudden it bombs on the .Name =, the message is

"Unable to set the Name property of the Series Class"

I have this feeling that SeriesCollection(2) really isn't there. But,
on the other hand, the values plotted. I can see it. I would think
there would be a way to create a series object and THEN add it to the
chart somehow.

(Seems a little flaky to rely on NewSeries returning the "next"
number. What if someone altered the code above later.)

Thank you.


Assign the new series a variable name, then use that to refer to it:

Code:
--------------------
Set NewSeries = mychart.SeriesCollection.NewSeries
NewSeries.Values = "='HCLHotBath'!R75C107: R75C250"
NewSeries.Name = "B2Alpha"

--------------------


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: 558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=163861

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Newseries; macro to code

On Dec 18, 7:05*pm, p45cal wrote:
cate;591297 Wrote:



Like a lot of stuff I do the macro thing first to get a general idea
of the landscape. *Here I'm up against the limits of my ability.


This has been working just fine for a while


myChart.SeriesCollection.NewSeries
myChart.SeriesCollection(2).Values = "='HCLHotBath'!
R75C107:R75C250"
myChart.SeriesCollection(2).Name = "B2Alpha"


Now, all of a sudden it bombs on the .Name =, the message is


"Unable to set the Name property of the Series Class"


I have this feeling that SeriesCollection(2) really isn't there. *But,
on the other hand, the values plotted. *I can see it. *I would think
there would be a way to create a series object and THEN add it to the
chart somehow.


(Seems a little flaky to rely on NewSeries returning the "next"
number. *What if someone altered the code above later.)


Thank you.


Assign the new series a variable name, then use that to refer to it:

Code:
--------------------
* * Set NewSeries = mychart.SeriesCollection.NewSeries
* NewSeries.Values = "='HCLHotBath'!R75C107: R75C250"
* NewSeries.Name = "B2Alpha"

--------------------

--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: 558
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=163861

Microsoft Office Help


Thank you. One more question. How would you 'tag' this new series.
Say the chart object got passed and I wanted to access this, or other,
speicific series there.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Newseries; macro to code


cate;591578 Wrote:
On Dec 18, 7:05*pm, p45cal wrote:
cate;591297 Wrote:



Like a lot of stuff I do the macro thing first to get a general

idea
of the landscape. *Here I'm up against the limits of my ability.


This has been working just fine for a while


myChart.SeriesCollection.NewSeries
myChart.SeriesCollection(2).Values = "='HCLHotBath'!
R75C107:R75C250"
myChart.SeriesCollection(2).Name = "B2Alpha"


Now, all of a sudden it bombs on the .Name =, the message is


"Unable to set the Name property of the Series Class"


I have this feeling that SeriesCollection(2) really isn't there.

*But,
on the other hand, the values plotted. *I can see it. *I would

think
there would be a way to create a series object and THEN add it to

the
chart somehow.


(Seems a little flaky to rely on NewSeries returning the "next"
number. *What if someone altered the code above later.)


Thank you.


Assign the new series a variable name, then use that to refer to it:

Code:
--------------------
* * Set NewSeries = mychart.SeriesCollection.NewSeries
* NewSeries.Values = "='HCLHotBath'!R75C107: R75C250"
* NewSeries.Name = "B2Alpha"

--------------------

--
p45cal

*p45cal*

------------------------------------------------------------------------
p45cal's Profile: 558
View this thread:'Newseries; macro to code - The Code Cage Forums'

(http://www.thecodecage.com/forumz/sh...d.php?t=163861)

'Microsoft Office Help' ("http://www.thecodecage.com)


Thank you. One more question. How would you 'tag' this new series.
Say the chart object got passed and I wanted to access this, or other,
speicific series there.


Well you've just named it so you can refer to it by that, but reliably
only if you've *not *named two or more series with the same name, with
the likes of:
myChart.SeriesCollection("B2Alpha")
otherwise it'll choose the first series of that name it comes across.


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: 558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=163861

Microsoft Office Help

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
.Chart.SeriesCollection.NewSeries.Values Kevin Excel Programming 1 April 23rd 09 06:20 PM
Slow code when used as VBA code instead of macro (copying visible columns) [email protected] Excel Programming 3 April 2nd 07 05:26 PM
Can I use code/macro to change code/macro in an existing file? Scott Bedows Excel Programming 2 February 14th 07 05:50 AM
Multiple large .NewSeries lead to Run-time error 1004 Dave Booker Excel Programming 6 August 23rd 05 03:58 AM
Line colour of .SeriesCollection.NewSeries? Dr.Ile[_3_] Excel Programming 1 June 17th 05 07:54 PM


All times are GMT +1. The time now is 07:40 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"