title: Themed Chart Styles for Excel charts using VBA
body: <p>I am trying to build some custom themes for excel charts in a dashboard. Upon recording a macro to see how these are implemented, the macro recorded the following code;</p>
  
  <pre><code>ActiveChart.ClearToMatchStyle
  ActiveChart.ChartStyle = 268
  </code></pre>
  
  <p>I have searched high and low via google to find a list of these chartstyles, or any documentation on how to customize them. Every search returns links for the chart type constants, i.e. xlLine, xlPie etc. NOT the themed charts available on the Chart Tools-Design tab in the Excel ribbon.</p>
  
  <p>If anyone can point me in the right direction it would be much appreciated.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>There is minimal to no documentation available for these Chart Style constants, so I created a sample workbook with all of the Chart Style types displayed as pie charts. It is available for you here. at least you will have a visual representation of the chart prior to choosing the type.</p>
  
  <p>The workbook can be viewed here, if anyone knows how to add a downloadable version in the post please comment</p>
  
  <p><a href="https://1drv.ms/x/s!Asf0Y5Y4GI3Mg6kZNRd1IA09NLWv9A" rel="nofollow">View the workbook here</a></p>
  
  <p>You can build it yourself with the following code, just add a sheet named ChartStyles and create a data table named GolfRoundsPlayed and use this data</p>
  
  <p>Month   Rounds Played
  Jan 42
  Feb 53
  Mar 77
  Apr 124
  May 198
  Jun 288
  Jul 312
  Aug 303
  Sep 264
  Oct 149
  Nov 54
  Dec 33</p>
  
  <pre><code>Sub BuildChartStyleSheet()
      Dim targetChart As Chart
      Dim targetSheet As Worksheet
      Dim top As Long
      Dim x As Integer, chtTitle As String
      top = 15
  
      Dim dataRange As Range
      Set dataRange = Range("GolfRoundsPlayed")
      Set targetSheet = Sheets("ChartStyles")
  
      Application.ScreenUpdating = False
      For x = 1 To 353
          If x &gt; 1 Then top = top + 128
          On Error Resume Next
          Set targetChart = targetSheet.Shapes.AddChart2(x, xlPie, 2, top, 230, 125).Chart
  
          chtTitle = "ChartStyle for ChartStyle #" &amp; x
          With targetChart
              .SetSourceData Source:=dataRange
              .chartTitle.Text = chtTitle
              .chartTitle.Format.TextFrame2.TextRange.Font.Size = 11
          End With
      Next x
     Application.ScreenUpdating = True
  End Sub
  </code></pre>