Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 72
Default Cannot assign a range to seriecollection values

I use the following code to assign a range in my macro. I checked with other
webite and the syntax seems to be correct.
Activesheet.chartobjects("Chart 1").activate
set rng = activesheet.range(cells(1,1), cells(x, y))
Activechart.seriescollection(1).values = rng

x and y are variables I set earlier in the code.
The error message I get is "run time error 1004. Unable to set the values
property of the series class

Thanks for the help.
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Cannot assign a range to seriecollection values

What does the .values property of SeriesCollection(1) refer to prior to
setting it to that range? If it contains all blanks or all errors, and it's
a line or XY chart, Excel VBA cannot assign anything to the series .Name,
..XValues, or .Values properties. Also, if both x and y are greater than 1,
Excel will not want to assign the range to a series. Only ranges that
contain a single cell, row, or column are valid entries.

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


"matelot" wrote in message
...
I use the following code to assign a range in my macro. I checked with
other
webite and the syntax seems to be correct.
Activesheet.chartobjects("Chart 1").activate
set rng = activesheet.range(cells(1,1), cells(x, y))
Activechart.seriescollection(1).values = rng

x and y are variables I set earlier in the code.
The error message I get is "run time error 1004. Unable to set the values
property of the series class

Thanks for the help.



  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 72
Default Cannot assign a range to seriecollection values

You are right! It doesn't work when the range is assigned to a blank range.
It's good to know. As a workaround, I load a row into an array and assign the
array into the seriecollection. That seems to work.

Thanks for letting me know about the blank range. BTW, great website to
learn about chart.

Thanks again.


"Jon Peltier" wrote:

What does the .values property of SeriesCollection(1) refer to prior to
setting it to that range? If it contains all blanks or all errors, and it's
a line or XY chart, Excel VBA cannot assign anything to the series .Name,
..XValues, or .Values properties. Also, if both x and y are greater than 1,
Excel will not want to assign the range to a series. Only ranges that
contain a single cell, row, or column are valid entries.

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


"matelot" wrote in message
...
I use the following code to assign a range in my macro. I checked with
other
webite and the syntax seems to be correct.
Activesheet.chartobjects("Chart 1").activate
set rng = activesheet.range(cells(1,1), cells(x, y))
Activechart.seriescollection(1).values = rng

x and y are variables I set earlier in the code.
The error message I get is "run time error 1004. Unable to set the values
property of the series class

Thanks for the help.




  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Cannot assign a range to seriecollection values

It's better to ultimately have the range assigned to the series data,
especially if it's a lot of points. My usual workaround is to change the
chart type temporarily to a column chart, which plots blanks as zeros, apply
the appropriate range, then change back to the original chart type.

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


"matelot" wrote in message
...
You are right! It doesn't work when the range is assigned to a blank
range.
It's good to know. As a workaround, I load a row into an array and assign
the
array into the seriecollection. That seems to work.

Thanks for letting me know about the blank range. BTW, great website to
learn about chart.

Thanks again.


"Jon Peltier" wrote:

What does the .values property of SeriesCollection(1) refer to prior to
setting it to that range? If it contains all blanks or all errors, and
it's
a line or XY chart, Excel VBA cannot assign anything to the series .Name,
..XValues, or .Values properties. Also, if both x and y are greater than
1,
Excel will not want to assign the range to a series. Only ranges that
contain a single cell, row, or column are valid entries.

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


"matelot" wrote in message
...
I use the following code to assign a range in my macro. I checked with
other
webite and the syntax seems to be correct.
Activesheet.chartobjects("Chart 1").activate
set rng = activesheet.range(cells(1,1), cells(x, y))
Activechart.seriescollection(1).values = rng

x and y are variables I set earlier in the code.
The error message I get is "run time error 1004. Unable to set the
values
property of the series class

Thanks for the 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
Assign number to correct range blinton25 Excel Discussion (Misc queries) 2 November 17th 06 01:41 PM
How do I assign a letter value to a range of data? clatters69 Excel Discussion (Misc queries) 1 September 16th 06 05:55 PM
Assign number to every value in a data range??? the dude Excel Worksheet Functions 1 May 16th 06 08:41 PM
assign a value to a range travelersway Excel Discussion (Misc queries) 7 November 2nd 05 03:16 PM
Assign values to text Town of Exeter Excel Worksheet Functions 0 August 17th 05 01:47 PM


All times are GMT +1. The time now is 07:38 AM.

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

About Us

"It's about Microsoft Excel"