Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default More chart problem Excel 97 - unable to set propert of series class

Hi can some help this code work I have to problems

Prob 1: is unable to set property of series class for the code on the xv
sv1 - sv3 in the following parts of this code: .SeriesCollection(1).Values
= sv1
Its is OK if the actual code is written as "='Mon 2nd-wk1' !R44C43:R44C32"
but not when used as sv1

Prob 2: the last two lines of code wont work. The graph when place in
C2:AF14 needs to be slighlty wider and the code was suggested on here but
does not work!


Sub ChartTrading()


Set r = Range("C2:AF14")

xv = "='" & ActiveSheet.Name & "' !R43C3:R43C32"
sv1 = "='" & ActiveSheet.Name & "' !R44C3:R44C32"
sv2 = "='" & ActiveSheet.Name & "' !R16C3:R16C32"
sv3 = "='" & ActiveSheet.Name & "' !R51C3:R51C32"

With r
Set chtobj = ActiveSheet.ChartObjects.Add(.Left, .Top, .Width,
..Height)
End With

With chtobj.Chart

.ChartType = xlColumnClustered
.SetSourceData Source:=Sheets("Mon 2nd-w1").Range("A1")
.SeriesCollection.NewSeries
.SeriesCollection.NewSeries
.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = xv
.SeriesCollection(1).Values = sv1
.SeriesCollection(2).Values = sv2
.SeriesCollection(3).Values = sv3
.Location Whe=xlLocationAsObject, Name:=ActiveSheet.Name
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
.Legend.Delete

End With

ActiveChart.Parent.ShapeRange.ScaleWidth 1.01, msoFalse,
msoScaleFromTopLeft
ActiveChart.Parent.ShapeRange.ScaleWidth 0.97, msoFalse,
msoScaleFromBottomRight
End Sub

Many Thanks again to all who reply!




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default More chart problem Excel 97 - unable to set propert of series class

Hello again,

Think I recognise some code in this!

Not sure about prob1, suggest you do something like

Debug,? sv1
look in the immediate window, Ctrl-g, and compare with the string that
works.

Prob 2: You are referring to ActiveChart but there isn't one, at least not
the new chtobj.chart unless you activate it in code

Try
chtobj.ShapeRange.ScaleWidth etc

Instead of "scaling" the chart, why not +/- the .height & .width
dimensions a bit, or multiply by a factor, when you create the chart.

Regards,
Peter T

"Karoo News" wrote in message
...
Hi can some help this code work I have to problems

Prob 1: is unable to set property of series class for the code on the xv
sv1 - sv3 in the following parts of this code:

..SeriesCollection(1).Values
= sv1
Its is OK if the actual code is written as "='Mon 2nd-wk1' !R44C43:R44C32"
but not when used as sv1

Prob 2: the last two lines of code wont work. The graph when place in
C2:AF14 needs to be slighlty wider and the code was suggested on here but
does not work!


Sub ChartTrading()


Set r = Range("C2:AF14")

xv = "='" & ActiveSheet.Name & "' !R43C3:R43C32"
Debug.= "='" & ActiveSheet.Name & "' !R44C3:R44C32"
sv2 = "='" & ActiveSheet.Name & "' !R16C3:R16C32"
sv3 = "='" & ActiveSheet.Name & "' !R51C3:R51C32"

With r
Set chtobj = ActiveSheet.ChartObjects.Add(.Left, .Top, .Width,
.Height)
End With

With chtobj.Chart

.ChartType = xlColumnClustered
.SetSourceData Source:=Sheets("Mon 2nd-w1").Range("A1")
.SeriesCollection.NewSeries
.SeriesCollection.NewSeries
.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = xv
.SeriesCollection(1).Values = sv1
.SeriesCollection(2).Values = sv2
.SeriesCollection(3).Values = sv3
.Location Whe=xlLocationAsObject, Name:=ActiveSheet.Name
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
.Legend.Delete

End With

ActiveChart.Parent.ShapeRange.ScaleWidth 1.01, msoFalse,
msoScaleFromTopLeft
ActiveChart.Parent.ShapeRange.ScaleWidth 0.97, msoFalse,
msoScaleFromBottomRight
End Sub

Many Thanks again to all who reply!






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
Unable to set the formula property of the series class Malhar Charts and Charting in Excel 1 July 24th 06 05:50 PM
Unable to set the XValues property of the Series class ramkumar_cpt Charts and Charting in Excel 5 November 29th 05 02:13 PM
Unable to Set XValues property of the Series class PGalla06[_18_] Excel Programming 0 September 30th 05 04:16 PM
Unable to set the XValues property of the Series class David Mullins via OfficeKB.com Excel Programming 0 January 26th 05 02:54 PM


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