Format only chart series that currently has a line (ignore just markers)

sndameron

New Member
Joined
Sep 21, 2014
Messages
30
I'm trying to find a way to execute a script that will format a selected chart. If the chart has a X series, in which some have lines, and others, I just wanted the markers displayed, I need the VBA to format the line thickness of just the series that has a line and ignore the series with just the marker. The code I have below formats the all series, so if my chart has just markers on it, when I run the code, it will then apply a line to the marker series even though I don't want it to.

Sub line_thickness()

Dim objSeries As Series

With ActiveChart
For Each objSeries In .SeriesCollection
With objSeries.Format.Line
.Weight = 2
' .ForeColor.RGB = RGB(100, 100, 100)
End With

With objSeries
' .MarkerBackgroundColor = RGB(102, 0, 102) 'purple
' .MarkerForegroundColor = RGB(102, 0, 102) ' purple
' .MarkerStyle = xlX
' .Smooth = False
.MarkerSize = 4
' .Shadow = False
End With
Next
End With
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Figured it out. Here's the code if anyone stumbles across this. I'm now trying to figure out how to manipulate just the marker line weight. I've read elsewhere that it's very difficult to do, and I still have not come across any code that works.

Sub line_thickness()



Dim objSeries As Series

With ActiveChart


For Each objSeries In .SeriesCollection
If objSeries.Format.Line.Visible Then
With objSeries.Format.Line
.Weight = 2
' .ForeColor.RGB = RGB(100, 100, 100)
End With
End If




With objSeries
' .MarkerBackgroundColor = RGB(102, 0, 102) 'purple
' .MarkerForegroundColor = RGB(102, 0, 102) ' purple
' .MarkerStyle = xl
' .Smooth = False
.MarkerSize = 4'
' .Shadow = False
End With
Next



End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,133
Messages
6,123,232
Members
449,092
Latest member
SCleaveland

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