Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Chart Identification Problems

Hi,

I have a macro which creates new workbooks with charts on them. One o
these charts on each workbook has 3 series' on them, however, some o
these different workbooks have only got data for 1 or 2 of thes
series'. When the code gets to where it shoudl rename the empty serie
I get an error. If I try to then test to see if the name is what i
should be with an If statement it says - unable to get the nam
property of the series class. Hope someone can help!

On Error Resume Next
Set myChart = Worksheets("Sheet1").ChartObjects.Add(chartLeft
chartTop, "384", "166")
With myChart.chart
.ChartType = xlLineMarkers

.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = "='[Kit_Tracker.xls]Charge
Breakdown'!R3C3:R3C" & varIP + 2
.SeriesCollection(1).Values = "='[Kit_Tracker.xls]Charge
Breakdown'!R" & varBreakdownRow & "C3:R" & varBreakdownRow & "C"
varIP + 2
.SeriesCollection(1).Name = "=""Lan PCs"""

.SeriesCollection.NewSeries
.SeriesCollection(2).XValues = "='[Kit_Tracker.xls]Charge
Breakdown'!R3C3:R3C" & varIP + 2
.SeriesCollection(2).Values = "='[Kit_Tracker.xls]Charge
Breakdown'!R" & varBreakdownRow + 1 & "C3:R" & varBreakdownRow + 1
"C" & varIP + 2
.SeriesCollection(2).Name = "=""Laptops"""

.SeriesCollection.NewSeries
.SeriesCollection(3).XValues = "='[Kit_Tracker.xls]Charge
Breakdown'!R3C3:R3C" & varIP + 2
.SeriesCollection(3).Values = "='[Kit_Tracker.xls]Charge
Breakdown'!R" & varBreakdownRow + 2 & "C3:R" & varBreakdownRow + 2
"C" & varIP + 2
.SeriesCollection(3).Name = "=""Unix"""

.HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Ki
Numbers"
.HasAxis(xlCategory, xlPrimary) = True
.HasAxis(xlValue, xlPrimary) = True

.HasLegend = True
.ChartArea.AutoScaleFont = False
.SizeWithWindow = False
End With

If Not myChart.chart.SeriesCollection(1).Name = "Lan PCs" Then
myChart.chart.SeriesCollection(1).Delete
End If
If Not myChart.chart.SeriesCollection(2).Name = "Laptops" Then
myChart.chart.SeriesCollection(2).Delete
End If
If Not myChart.chart.SeriesCollection(3).Name = "Unix" Then
myChart.chart.SeriesCollection(3).Delete
End I

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Chart Identification Problems

Nest the code that errors for this reason in

On Error Resume Next

' Just the code that works with the possibly non existent series
On Error goto 0

--
Regards,
Tom Ogilvy

"lopsided " wrote in message
...
Hi,

I have a macro which creates new workbooks with charts on them. One of
these charts on each workbook has 3 series' on them, however, some of
these different workbooks have only got data for 1 or 2 of these
series'. When the code gets to where it shoudl rename the empty series
I get an error. If I try to then test to see if the name is what it
should be with an If statement it says - unable to get the name
property of the series class. Hope someone can help!

On Error Resume Next
Set myChart = Worksheets("Sheet1").ChartObjects.Add(chartLeft,
chartTop, "384", "166")
With myChart.chart
ChartType = xlLineMarkers

SeriesCollection.NewSeries
SeriesCollection(1).XValues = "='[Kit_Tracker.xls]Charges
Breakdown'!R3C3:R3C" & varIP + 2
SeriesCollection(1).Values = "='[Kit_Tracker.xls]Charges
Breakdown'!R" & varBreakdownRow & "C3:R" & varBreakdownRow & "C" &
varIP + 2
SeriesCollection(1).Name = "=""Lan PCs"""

SeriesCollection.NewSeries
SeriesCollection(2).XValues = "='[Kit_Tracker.xls]Charges
Breakdown'!R3C3:R3C" & varIP + 2
SeriesCollection(2).Values = "='[Kit_Tracker.xls]Charges
Breakdown'!R" & varBreakdownRow + 1 & "C3:R" & varBreakdownRow + 1 &
"C" & varIP + 2
SeriesCollection(2).Name = "=""Laptops"""

SeriesCollection.NewSeries
SeriesCollection(3).XValues = "='[Kit_Tracker.xls]Charges
Breakdown'!R3C3:R3C" & varIP + 2
SeriesCollection(3).Values = "='[Kit_Tracker.xls]Charges
Breakdown'!R" & varBreakdownRow + 2 & "C3:R" & varBreakdownRow + 2 &
"C" & varIP + 2
SeriesCollection(3).Name = "=""Unix"""

HasTitle = False
Axes(xlValue, xlPrimary).HasTitle = True
Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Kit
Numbers"
HasAxis(xlCategory, xlPrimary) = True
HasAxis(xlValue, xlPrimary) = True

HasLegend = True
ChartArea.AutoScaleFont = False
SizeWithWindow = False
End With

If Not myChart.chart.SeriesCollection(1).Name = "Lan PCs" Then
myChart.chart.SeriesCollection(1).Delete
End If
If Not myChart.chart.SeriesCollection(2).Name = "Laptops" Then
myChart.chart.SeriesCollection(2).Delete
End If
If Not myChart.chart.SeriesCollection(3).Name = "Unix" Then
myChart.chart.SeriesCollection(3).Delete
End If


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Chart Identification Problems

Hi Tom

Thanks for your reply but im not sure I follow

--
Message posted from http://www.ExcelForum.com

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
Get two lines instead of one for sheet identification Farm boy Setting up and Configuration of Excel 1 November 22nd 08 12:48 PM
Identification of what day it is [email protected] Excel Worksheet Functions 5 March 8th 08 07:47 PM
Currency identification Balaji Excel Discussion (Misc queries) 2 August 18th 07 07:38 AM
checkbox identification devin Excel Programming 0 January 21st 04 04:15 PM
checkbox identification devin Excel Programming 1 January 14th 04 04:19 PM


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

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"