Name

series.Explosion [= setting]

Synopsis

For pie and doughnut chart types, sets or returns the amount to move the series out from the center (exploded view) as a percentage of the diameter of the chart. The following code explodes one piece out of a pie chart:

Sub ExplodeSlice(  )
    Dim chrt As Chart, sr As Series
    ' Get a chart.
    Set chrt = ActiveChart
    chrt.ChartType = xlLine
    ' Get first series
    Set sr = chrt.SeriesCollection(1)
    ' Use a pie chart type.
    sr.ChartType = xlPie
    ' Keep pie together
    sr.Explosion = 0
    ' Explode last piece.
    sr.Points(sr.Points.Count).Explosion = 50
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.