LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
 
Posts: n/a
Default Dynamically Change Row Count Using SeriesCollection(n).Values

I have a chart that displays data in 3 columns. The amount of data
differs depending on the reports settings. Using VBA in Excel 2002 I
am using the following code.....

Private Sub Build_RealTimeGraph(ChartTitle As String)

Dim cht As Chart
Dim Temp As String

On Error Resume Next

Sheet7.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartTitle.Select
Selection.Characters.Text = ChartTitle

With ActiveChart
Temp = "=Graph!R4C5:R" & ReportLineCount - 1 & "C5"
.SeriesCollection(1).Values = Temp
.Refresh
Temp = "=Graph!R4C6:R" & ReportLineCount - 1 & "C6"
.SeriesCollection(2).Values = Temp
.Refresh
Temp = "=Graph!R4C4:R" & ReportLineCount - 1 & "C4"
.SeriesCollection(3).Values = Temp
.Refresh

Temp = "=Graph!R4C3:R" & ReportLineCount - 1 & "C3"
.SeriesCollection(1).XValues = Temp
.Refresh
.SeriesCollection(2).XValues = Temp
.Refresh
.SeriesCollection(3).XValues = Temp
.Refresh
End With
'Set cht = ActiveChart

'With cht
' Temp = "=Graph!R4C5:R" & ReportLineCount - 1 & "C5"
' .SeriesCollection(1).Values = Temp
' Temp = "=Graph!R4C6:R" & ReportLineCount - 1 & "C6"
' .SeriesCollection(2).Values = Temp
' Temp = "=Graph!R4C4:R" & ReportLineCount - 1 & "C4"
' .SeriesCollection(3).Values = Temp
'
' Temp = "=Graph!R4C3:R" & ReportLineCount - 1 & "C3"
' .SeriesCollection(1).XValues = Temp
' .SeriesCollection(2).XValues = Temp
' .SeriesCollection(3).XValues = Temp
' .Refresh
' End With
' Set cht = Nothing
Application.ScreenUpdating = True
End Sub

As you can see I also tried to use the Chart object as well and is
commented out in the code above. The problem I am having is that the
series does not seem to change in the chart at all. If I manually
change the series to another column and rows, it stays that way even
after the code above is run. The chart's title changes though.

Thanks

Ryan

 
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
Can I change a cell and cause an automatic change in other cells Swissmiss Excel Worksheet Functions 2 August 12th 05 05:00 PM
Count if array contains cells of a certain value Melissa Excel Worksheet Functions 2 July 29th 05 02:37 AM
How do I get the font color to change automatically depending on gtcarlsbad Excel Discussion (Misc queries) 2 February 1st 05 02:39 AM
How do I link two cells as to allow me to change the value in eit. jpvlvt Excel Discussion (Misc queries) 3 January 26th 05 01:28 AM
Change Axes Scale Dynamically Fysh Charts and Charting in Excel 3 December 16th 04 02:57 PM


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