![]() |
REformatting PivotChart
Mike -
Does the BP series have any data in it? If it's all blank, you won't be able to select it. - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Mike Collard wrote: I have a PivotChart that needs reformating each time it is refreshed - the number of data series changes depending on the selection so I have the code below to apply the appropriate format. However, I get a runtime error 1004 Method 'SeriesCollection' of object '_Chart failed when certain series are present i.e. it works sometimes and not others. Very grateful for any help. Mike Collard Sub Reformat() Dim iSrsCt As Integer, iSrsIx As Integer iSrsCt = ActiveChart.SeriesCollection.Count Application.ScreenUpdating = False For iSrsIx = 1 To iSrsCt Select Case ActiveChart.SeriesCollection(iSrsIx).Name Case "BP" ActiveChart.SeriesCollection(iSrsCx).Select ERROR HERE With Selection.Border .ColorIndex = 4 .Weight = xlMedium .LineStyle = xlContinuous End With Case "ESSO" ActiveChart.SeriesCollection(iSrsIx).Select With Selection.Border .ColorIndex = 1 .Weight = xlMedium .LineStyle = xlContinuous End With End Select Next End sub |
REformatting PivotChart
This may be a stupid question, but....
on your line: ActiveChart.SeriesCollection(iSrsCx).Select ERROR HERE Do you mean to have iSrsCx or iSrsIx.... just asking cuz you didn't dim it and you dimmed everything else. On Fri, 08 Aug 2003 00:24:48 -0400, Jon Peltier wrote: Mike - Does the BP series have any data in it? If it's all blank, you won't be able to select it. - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Mike Collard wrote: I have a PivotChart that needs reformating each time it is refreshed - the number of data series changes depending on the selection so I have the code below to apply the appropriate format. However, I get a runtime error 1004 Method 'SeriesCollection' of object '_Chart failed when certain series are present i.e. it works sometimes and not others. Very grateful for any help. Mike Collard Sub Reformat() Dim iSrsCt As Integer, iSrsIx As Integer iSrsCt = ActiveChart.SeriesCollection.Count Application.ScreenUpdating = False For iSrsIx = 1 To iSrsCt Select Case ActiveChart.SeriesCollection(iSrsIx).Name Case "BP" ActiveChart.SeriesCollection(iSrsCx).Select ERROR HERE With Selection.Border .ColorIndex = 4 .Weight = xlMedium .LineStyle = xlContinuous End With Case "ESSO" ActiveChart.SeriesCollection(iSrsIx).Select With Selection.Border .ColorIndex = 1 .Weight = xlMedium .LineStyle = xlContinuous End With End Select Next End sub |
All times are GMT +1. The time now is 05:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com