ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Works in 2007 but not 2003 (https://www.excelbanter.com/excel-discussion-misc-queries/211332-works-2007-but-not-2003-a.html)

teepee[_3_]

Works in 2007 but not 2003
 
The following code works in Excel 2007 but not 2003. Anyone know why? Fails
on second line - although if I hash that line out it then fails on third
line.

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(2).Name = "=""Male"""
ActiveChart.SeriesCollection(2).Values = "=WMP!$Bm$4:$Bm$64"



Barb Reinhardt

Works in 2007 but not 2003
 
I'm thinking this should work in both

Dim aWS As Worksheet
Dim myWS As Worksheet
Set aWS = ActiveSheet
Set myWS = ThisWorkbook.Worksheets("WMP")

aWS.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(2).Name = "=""Male"""
ActiveChart.SeriesCollection(2).Values = myWS.Range("BM4:BM64")

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"teepee" wrote:

The following code works in Excel 2007 but not 2003. Anyone know why? Fails
on second line - although if I hash that line out it then fails on third
line.

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(2).Name = "=""Male"""
ActiveChart.SeriesCollection(2).Values = "=WMP!$Bm$4:$Bm$64"




OssieMac

Works in 2007 but not 2003
 
Hi,

Following line works fine in xl2002 so can't think why it does not work in
xl2003.
ActiveChart.SeriesCollection(2).Name = "=""Male"""

For values line try changing range format.
ActiveChart.SeriesCollection(2).Values = "=WMP!R4C65:R64:C65"

--
Regards,

OssieMac


"teepee" wrote:

The following code works in Excel 2007 but not 2003. Anyone know why? Fails
on second line - although if I hash that line out it then fails on third
line.

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(2).Name = "=""Male"""
ActiveChart.SeriesCollection(2).Values = "=WMP!$Bm$4:$Bm$64"




teepee[_3_]

Works in 2007 but not 2003
 
many thanks



teepee[_3_]

Works in 2007 but not 2003
 

"OssieMac" wrote

ActiveChart.SeriesCollection(2).Values = "=WMP!R4C65:R64:C65"


I think you mean "=WMP!R4C65:R64C65"

For some reason it also doesn't work in 2003 but does in 2007. Weird



teepee[_3_]

Works in 2007 but not 2003
 

"Barb Reinhardt" wrote in message
...
I'm thinking this should work in both

Dim aWS As Worksheet
Dim myWS As Worksheet
Set aWS = ActiveSheet
Set myWS = ThisWorkbook.Worksheets("WMP")

aWS.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(2).Name = "=""Male"""
ActiveChart.SeriesCollection(2).Values = myWS.Range("BM4:BM64")

--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.


No sorry didn't work



teepee[_3_]

Works in 2007 but not 2003
 
This is very weird.

I have two macros - one to hide the line by referring it to a blank column
(column 60) and one to show it by refering to the right column (column 64).
Both work in 2007 but only the former works in 2003. Mad - they're more or
less identical

Sub graphall()

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Name = "=""All"""
ActiveChart.SeriesCollection(1).Values = "=WMP!R4C64:R64C64"
Range("Aq1").Select
End Sub

Sub nographall()

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Name = "=""All"""
ActiveChart.SeriesCollection(1).Values = "=WMP!R4C60:R64C60"
Range("Aq1").Select

End Sub



teepee[_3_]

Works in 2007 but not 2003
 
The error, incidently, is 1004 - "unable to set the name property of the
series class"



OssieMac

Works in 2007 but not 2003
 
Previously I did not understand that you were trying to set the series to a
null range of data. Same thing happens when I try it in xl2002.

I suggest that you repost a question "How to Hide/Unhide a series on a
chart". Post it under Excel Charts on the MS Commnunites site.

--
Regards,

OssieMac


"teepee" wrote:

This is very weird.

I have two macros - one to hide the line by referring it to a blank column
(column 60) and one to show it by refering to the right column (column 64).
Both work in 2007 but only the former works in 2003. Mad - they're more or
less identical

Sub graphall()

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Name = "=""All"""
ActiveChart.SeriesCollection(1).Values = "=WMP!R4C64:R64C64"
Range("Aq1").Select
End Sub

Sub nographall()

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Name = "=""All"""
ActiveChart.SeriesCollection(1).Values = "=WMP!R4C60:R64C60"
Range("Aq1").Select

End Sub




teepee[_3_]

Works in 2007 but not 2003
 

"OssieMac" wrote

Previously I did not understand that you were trying to set the series to
a
null range of data. Same thing happens when I try it in xl2002.


Ah it's the null data that's the problem. Of course. Thanks.

I'll just set the column to zeroes and repaint the graph line the same as
background colour. Thanks for your help.




All times are GMT +1. The time now is 11:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com