Select multiple graphs and apply same formatting

Soum_

New Member
Joined
Sep 11, 2023
Messages
1
Hello,

I have several curves on the same charts and want to apply a specific formatting to a group of curves.
Do you know how to select charts with vba and chose the desired style?
I am new to vba, so I am looking for something simple and this is what I did so far :

ActiveChart.Shapes.Range(Array("Chart1", "Chart2")).Select
With Selection.Format.Line
Selection.MarkerStyle = -4142
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent5
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
End With

Thank you
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi *Soum and Welcome to the Board! Here's the basic outline for formatting all chart series. Adjust the sheet and chart name to suit. HTH. Dave
Code:
Dim Cnt As Integer
For Cnt = 1 To Sheets("Sheet1").ChartObjects("Chart1").Chart.SeriesCollection.Count
With Sheets("Sheet1").ChartObjects("Chart1").Chart.SeriesCollection(Cnt)
'.Border.ColorIndex = 1
'.Border.Weight = xlMedium
'.Border.LineStyle = xlContinuous
.MarkerStyle = xlMarkerStyleNone
'.MarkerStyle = -4142
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent5
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
End With
Next Cnt
ps. Please use code tags
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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