You shouldn't need to select it in the first place:
![]()
Sub FormatChart_Coverage(strChart As String) Dim cht As Chart Dim srs As Series Set cht = ThisWorkbook.Sheets("Report").ChartObjects(strChart).Chart With cht .SetElement (msoElementLegendNone) ''Hide the legend .SetElement (msoElementDataTableWithLegendKeys) ''Show the data table For Each srs In .SeriesCollection If srs.Name = "Total" Then srs.AxisGroup = 2 With srs.Border .Weight = xlThin .LineStyle = xlNone End With srs.Interior.ColorIndex = xlNone ElseIf srs.Name = "YTD Goal" Then srs.ChartType = xlLineMarkers With srs .MarkerStyle = -4115 .MarkerSize = 13 .MarkerBackgroundColorIndex = 3 .MarkerForegroundColorIndex = 3 End With srs.Border.LineStyle = xlNone End If Next srs .DataTable.Font.Size = 8 With .Axes(xlValue, xlSecondary) .MajorTickMark = xlNone .TickLabelPosition = xlNone End With End With ThisWorkbook.Sheets("Report").ChartObjects(strChart).OnAction = "'" & ThisWorkbook.Name & "'!Drill_CoverageForm" End Sub
Bookmarks