remove the border for all series for all charts

V

velocityinc

Attempting to remove the border for all series for all charts in my
spreadsheet. can this be modified? if so, pelase suggest how?

thanks


Sub Macro1()
'
' Macro1 Macro
' Macro recorded 4/9/2007 by b0467256
'

'
ActiveSheet.ChartObjects("Chart 10").Activate
ActiveChart.SeriesCollection(8).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
Selection.Interior.ColorIndex = xlAutomatic
End Sub
 
J

Joel

For Each AllCharts In Worksheets("Chart 10").Shapes

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 4/9/2007 by b0467256
'

'
For Each AllCharts In Worksheets("Chart 10").Shapes
ActiveSheet.ChartObjects(AllCharts.name).Activate
ActiveChart.SeriesCollection(8).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
Selection.Interior.ColorIndex = xlAutomatic
next AllCharts
End Sub
 
V

velocityinc

For Each AllCharts In Worksheets("Chart 10").Shapes

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 4/9/2007 by b0467256
'

'
For Each AllCharts In Worksheets("Chart 10").Shapes
ActiveSheet.ChartObjects(AllCharts.name).Activate
ActiveChart.SeriesCollection(8).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
Selection.Interior.ColorIndex = xlAutomatic
next AllCharts
End Sub






- Show quoted text -

When I run it the editor highlights all charts and says expected sub,
function, or property? need some help please. This is for all charts
in my workbook and for all series. thanks.
 
J

Joel

I didn't notice your chart was on a worksheet and not in a worksheet

Sub xyz()
For Each Allcharts In Charts

Charts(Allcharts.Name).Activate
ActiveChart.SeriesCollection(8).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
Selection.Interior.ColorIndex = xlAutomatic


Next Allcharts
End Sub
 
V

velocityinc

I didn't notice your chart was on a worksheet and not in a worksheet

Sub xyz()
For Each Allcharts In Charts

Charts(Allcharts.Name).Activate
ActiveChart.SeriesCollection(8).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
Selection.Interior.ColorIndex = xlAutomatic

Next Allcharts
End Sub






- Show quoted text -

Thanks, Is there a way to use all the selected series and not be
limited to just the series 8. the code works well otherwise.
 
J

Joel

Try something like this. It will work for 8 series. Don't know if all
charts have 8 series. Let me know if this doesn't work. I think there is a
way to test how many series are in each chart, but I will have to try this
tomorrow.

I'm not going to do anything unless I get a return posting.

Sub xyz()
For Each Allcharts In Charts

Charts(Allcharts.Name).Activate
for series = 1 to 8
ActiveChart.SeriesCollection(8).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
Selection.Interior.ColorIndex = xlAutomatic
next series

Next Allcharts
End Sub
 
V

velocityinc

Try something like this. It will work for 8 series. Don't know if all
charts have 8 series. Let me know if this doesn't work. I think there is a
way to test how many series are in each chart, but I will have to try this
tomorrow.

I'm not going to do anything unless I get a return posting.

Sub xyz()
For Each Allcharts In Charts

Charts(Allcharts.Name).Activate
for series = 1 to 8
ActiveChart.SeriesCollection(8).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
Selection.Interior.ColorIndex = xlAutomatic
next series

Next Allcharts
End Sub






- Show quoted text -

Im afraid it does not change all the series. Please help.
 
J

Joel

Guarenteed to work

Sub xyz()
For Each Allcharts In Charts

Charts(Allcharts.Name).Activate

For Series = 1 To ActiveChart.SeriesCollection.Count
ActiveChart.SeriesCollection(Series).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
Selection.Interior.ColorIndex = xlAutomatic
Next Series

Next Allcharts
End Sub
 
J

Jon Peltier

Much faster and more direct, and will not flash with each selection of
another chart.

Sub NoSeriesBorders()
Dim chtob As ChartObject
Dim srs As Series
For Each chtob In ActiveSheet.ChartObjects
For Each srs In chtob.Chart.SeriesCollection
On Error Resume Next
srs.Border.LineStyle = xlNone
On Error Goto 0
Next
Next
End Sub

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top