LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default need help adding named range as new series to a graph

I have a graph with up to 6 series. I need to dynamically add and remove
series depending on how what data is present.I don't know how to do it well,
so I am deleting all but one existing series and adding back one series at a
time until I get the right number I need.

All my series are set to named ranges, but I'm having trouble with the VBA
syntax to add a named range as a new series. Below is some edited code I
have so far, originally based on a recorded macro; I don't think it is
copying the named range to add it as a new series. Optimally, I'd like to
add a new series and have it (in the data source) refer directly to the
named range, rather than the specific cells in that range, so I can change
the graph by changing the named range if needed.
Any help greatly appreciated,
keith

Sub resetseries()

On Error Resume Next
ActiveSheet.ChartObjects("Chart 22").Activate
ActiveChart.SeriesCollection(6).Select
Selection.Delete
ActiveChart.SeriesCollection(5).Select
Selection.Delete
ActiveChart.SeriesCollection(4).Select
Selection.Delete
ActiveChart.SeriesCollection(3).Select
Selection.Delete

TotalSeries = (Sheet1.Range("B8").Value)
If TotalSeries 1 Then
For j = TotalSeries To 1 Step -1
AddEachSeries = Choose(j, Act1, Act2, Act3, Act4, Act5)
AddEachSeries.Copy
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection.Paste Rowcol:=xlColumns,
SeriesLabels:=False, _
CategoryLabels:=False, Replace:=False, NewSeries:=True
ActiveChart.SeriesCollection(SeriesNum).Select
Application.CutCopyMode = False
ActiveChart.SeriesCollection(SeriesNum).ChartType =
xlColumnClustered
Next
End If
End Sub


 
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
provide value to data series from named range SHETTY Charts and Charting in Excel 0 June 18th 08 01:25 PM
Charts - named range ref in SERIES() - Can't find it Gdareos[_2_] New Users to Excel 2 March 23rd 08 03:18 PM
Series Named Range Problem Arturo Charts and Charting in Excel 1 July 3rd 07 09:31 PM
Adding more series to 2 axis line graph kate Excel Discussion (Misc queries) 2 February 2nd 07 07:38 PM
Add a data series dynamically to a named range? Popeye Charts and Charting in Excel 3 March 10th 06 08:59 PM


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