title: Using VBA to put a chart series on the secondary X axis
body: <p>I have a line chart to which I'm attempting to add, via VBA, a horizontal line at a given Y value. I'm following <a href="http://peltiertech.com/Excel/Charts/AddLineHorzSeries.html" rel="noreferrer">this guide</a>, which suggests adding a line to an existing chart and then changing its type to scatter, which causes Excel to put the series on the secondary X axis automatically. It can then be formatted further.</p>
  
  <p>My problem is that when doing this with VBA I don't understand how to switch a line onto the secondary X axis. By default all new lines will go on the primary X axis.</p>
  
  <p>For example, suppose <code>chrt</code> is a Chart object:</p>
  
  <pre><code>' Enable secondary X axis (I think)
  chrt.HasAxis(XlAxisType.xlCategory, XlAxisGroup.xlSecondary) = True
  
  Dim se As Series
  Set se = chrt.SeriesCollection.NewSeries
  se.ChartType = xlXYScatterLinesNoMarkers
  
  ' Add a line at Y = 0
  se.xValues = Array(0, 1)
  se.values = Array(0, 0)
  </code></pre>
  
  <p>Now, how to get <code>se</code> onto the secondary X axis?</p>