Format multiple series on a chart with macro

ttbuson

Board Regular
Joined
Nov 18, 2011
Messages
80
I have the following vba code obtained from the macro recorder for changing a data series in an xy scatterplot to a black diamond. Is there any way to edit this so that it does it for all series on a chart? I have about 50 series and would like the macro to go through each one and do the same thing. It would also be helpful to do it for certain series. Thanks!

Code:
Sub Format_RR_dataseries()

    ActiveSheet.ChartObjects("Chart 1").Activate
    ActiveChart.SeriesCollection(11).Select
    With Selection
        .MarkerStyle = 2
        .MarkerSize = 7
        .Format.Fill.ForeColor.ObjectThemeColor = msoThemeColorText1
        .Format.Line.Visible = msoFalse
    End With
    Range("I14").Select
End Sub
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi

Try:

Code:
Sub Format_RR_dataseries()
Dim ser As Series
 
    With ActiveSheet.ChartObjects("Chart 1").Chart
        For Each ser In .SeriesCollection
            With ser
                .MarkerStyle = 2
                .MarkerSize = 7
                .Format.Fill.ForeColor.ObjectThemeColor = msoThemeColorText1
                .Format.Line.Visible = msoFalse
            End With
        Next ser
    End With
End Sub
 
Upvote 0
Awesome, this works great! How would I edit it to only apply the macro to a certain series range like say 1 to 12 or 20 to 30?
 
Upvote 0
Hi again

Try:


Code:
Sub Format_RR_dataseries()
Dim j As Long
 
    With ActiveSheet.ChartObjects("Chart 1").Chart
        For j = 1 To 12
            With .SeriesCollection(j)
                .MarkerStyle = 2
                .MarkerSize = 7
                .Format.Fill.ForeColor.ObjectThemeColor = msoThemeColorText1
                .Format.Line.Visible = msoFalse
            End With
        Next j
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,806
Members
449,048
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top