Removing Series Line from Graph

captculver

Board Regular
Joined
Dec 8, 2008
Messages
60
I have VBA code written to copy a graph, delete 2 series from the graph, replace the values of another series, and then add 2 new series. I do not want to graph the 2 new series in the plot area; I just want the values displayed in the data table. I'm working with patient satisfaction scores and I have the goal and score graphed in the plot area; the 2 new series I'm adding are the numerator and denominator. Typically these won't show up in the plot area since the MIN and MAX values for the axis are set at .5 and 1.0 (50% to 100%). However, we do have a couple of low volume units where we could see a numerator or denominator of 1 or 0 and I don't want those series lines to show in the graph.

The macro recorder clued me in on how to eliminate the markers, but not the line. Here's the code I have so far:

Private Sub Copy_SLHS_CHARTS()
' OVERALL CHART QUESTIONS
'
Worksheets("SLHS_DB").ChartObjects("OVERALL_SLHS_CHT").Activate
ActiveChart.ChartArea.Copy
Range("F75").Select
ActiveSheet.Paste
With ActiveChart
.Parent.Name = "Q21_SLHS_CHT"
.ChartTitle.Text = "SLHS Q21"
.SeriesCollection(2).Delete
.SeriesCollection(2).Delete
End With
ActiveSheet.ChartObjects("Q21_SLHS_CHT").Activate
With ActiveChart.SeriesCollection(2)
.Name = "Q21"
.Values = "Q21!Q21_SLHS_P_12"
.XValues = "Q21!Q21_CHTCAT_12"
End With
With ActiveChart.SeriesCollection.NewSeries
.Name = "Num"
.Values = "Q21!Q21_slhs_n_12"
.XValues = "q21!Q21_chtcat_12"
.MarkerStyle = xlMarkerStyleNone
End With
With ActiveChart.SeriesCollection.NewSeries
.Name = "Den"
.Values = "Q21!Q21_SLHS_D_12"
.XValues = "Q21!Q21_CHTCAT_12"
.MarkerStyle = xlMarkerStyleNone
End With
End Sub

Thanks very much for your time and assistance.
Chuck
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,224,427
Messages
6,178,585
Members
452,859
Latest member
dallasazcat

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