Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
raydenl
 
Posts: n/a
Default Primary/Secondary Axis series count


Hi, I have a VBA function like so:


Code:
--------------------

Private Sub AddSeries(ByVal strName As String, ByVal rngValues As Range, ByVal rngValuesX As Range, ByVal xlAxis As XlAxisGroup)
With Charts("Chart").SeriesCollection.NewSeries
.AxisGroup = xlAxis

.ChartType = xlLine
.Name = strName
.Values = rngValues
.XValues = rngValuesX
End With
End Sub

--------------------


Sometimes I add a series to the Primary Y axis and other times to the
Secondary.

How can I determine how many series are on the Primary and how many on
the secondary?????

Application could begin with an unknown number of series already
present on each axis so can't use a counter.

Cheers,
Rayden


--
raydenl
------------------------------------------------------------------------
raydenl's Profile: http://www.excelforum.com/member.php...o&userid=25668
View this thread: http://www.excelforum.com/showthread...hreadid=390832

  #2   Report Post  
Andy Pope
 
Posts: n/a
Default

Hi,

Here is a code snippet that will display count of series on primary and
secondary axis.

Sub x()
Dim intCountP As Integer
Dim intCountS As Integer
Dim objSeries As Series

With ActiveChart
For Each objSeries In .SeriesCollection
If objSeries.AxisGroup = xlPrimary Then
intCountP = intCountP + 1
Else
intCountS = intCountS + 1
End If
Next
End With
MsgBox "Primary axis has " & intCountP & " Series" & vbLf & _
"Secondary axis has " & intCountS & " Series"
End Sub

Cheers
Andy

raydenl wrote:
Hi, I have a VBA function like so:


Code:
--------------------

Private Sub AddSeries(ByVal strName As String, ByVal rngValues As Range, ByVal rngValuesX As Range, ByVal xlAxis As XlAxisGroup)
With Charts("Chart").SeriesCollection.NewSeries
.AxisGroup = xlAxis

.ChartType = xlLine
.Name = strName
.Values = rngValues
.XValues = rngValuesX
End With
End Sub

--------------------


Sometimes I add a series to the Primary Y axis and other times to the
Secondary.

How can I determine how many series are on the Primary and how many on
the secondary?????

Application could begin with an unknown number of series already
present on each axis so can't use a counter.

Cheers,
Rayden



--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
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
Count Position of Filtered TEXT cells in a column Sam via OfficeKB.com Excel Worksheet Functions 8 May 18th 05 04:23 AM
series graph -- one series being added to another series rich zielinski via OfficeKB.com Charts and Charting in Excel 3 March 30th 05 06:23 PM
Dynamic series in Chart Jeff Charts and Charting in Excel 2 February 24th 05 11:54 AM
How do I add a second axis to a graph with 2 data series? Laura Charts and Charting in Excel 2 February 2nd 05 03:30 PM
graphing two series on x axis Ladislav Ligart Charts and Charting in Excel 2 December 6th 04 06:50 PM


All times are GMT +1. The time now is 07:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"