PDA

View Full Version : Fullseriescollection - replacing Excel 2013 VBA with Excel 2010 - help!



jack2013
11-07-2013, 10:13 AM
Hi All,

I'm having some VBA code compatibility issues. I put together some code in Excel 2013 that uses the "fullseriescollection" object, however I have now discovered that the code wont work correctly in eXcel 2010. The code is meant to reformat a chart based on the max value of one of the ranges (The code hides one of the ranges that would make the scale too big as it is 10x larger than the next closest value).

Would I be OK to just replace with "seriescollection"? The code I am using is:


Sub pivotFormat()




Dim maxrange As Double




maxrange = Application.WorksheetFunction.Max(Range("k14:k26"))




ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.FullSeriesCollection(3).ChartType = xlLine
ActiveChart.FullSeriesCollection(3).AxisGroup = 2
ActiveChart.FullSeriesCollection(2).ChartType = xlLine
ActiveChart.FullSeriesCollection(1).ChartType = xlLine
ActiveChart.FullSeriesCollection(2).AxisGroup = 2
ActiveChart.FullSeriesCollection(1).AxisGroup = 2
ActiveChart.Axes(xlValue, xlSecondary).Select
ActiveChart.Axes(xlValue, xlSecondary).MaximumScale = maxrange * 1.1
ActiveChart.Axes(xlValue, xlSecondary).MinimumScale = 0
ActiveChart.Axes(xlValue).Select
ActiveChart.Axes(xlValue).MaximumScaleIsAuto = True
ActiveChart.FullSeriesCollection(1).Select
Selection.Format.Line.Visible = msoFalse
ActiveChart.FullSeriesCollection(2).Select
Selection.Format.Line.Visible = msoFalse
ActiveChart.FullSeriesCollection(5).Select
Selection.Format.Line.Visible = msoFalse
ActiveChart.FullSeriesCollection(5).AxisGroup = 2
ActiveChart.FullSeriesCollection(6).Select
Selection.Format.Line.Visible = msoFalse
ActiveChart.FullSeriesCollection(6).AxisGroup = 2

End Sub

Thanks for any advice!

Aflatoon
11-08-2013, 12:59 AM
It appears so from a quick read through.

jack2013
11-08-2013, 07:53 AM
Just tried and seems to have worked, thanks!