title: Changing Axis Scale based on the dynamic cell values
body: <p>I have a code that loops through changing the values for a chart and exporting that chart once the values have been added. However, some values affect the format of the chart because the values are beyond the bounds of the horizontal (value) axis, which is currently set at min: -15 and max: 15. I'm hoping to create an IFThen section where if one of the values for the chart is > 15 AND &lt; -15 then change the boundaries to min: -20 and max: 20. Then if the values for the chart is > 20 AND &lt; -20 then to change the boundaries to min: -30 and max: 30. 
  I have the chart attached below. The chart is actually two graphs on top of each other so I have a Horizontal (Value) Axis and a Secondary Horizontal (Value) Axis. Both of which need to change with the IfThen statements. </p>
  
  <p><a href="https://i.stack.imgur.com/zkg0D.png" rel="nofollow noreferrer">ChartImage</a></p>
  
  <p>Here is the code I have:</p>
  
  <pre><code>Range("D3").Select   
      ActiveCell.Range("B1:J1").Select
  
  Dim myPDF As String
  Dim i As Long
  
      For counter = 3 To 102    
          Sheets("Data").Select
          Range("'Data'!$D$" &amp; counter &amp; ":$L$" &amp; counter).Select
          Selection.Copy
          Sheets("Pyramid-Chart").Select
          Range("C3:C11").Select
          Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
              False, Transpose:=True
          Sheets("Data").Select
          Range("'Data'!$N$" &amp; counter &amp; ":$V$" &amp; counter).Select
          Selection.Copy
          Sheets("Pyramid-Chart").Select
          Range("D3:D11").Select
          Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
              False, Transpose:=True
  
          ActiveSheet.ChartObjects("Chart 2").Activate
          ActiveChart.ChartArea.Select
          myPDF = "\\stchsfs\arboari$\Profile-Data\Desktop\Export Trial1\c1-" &amp; Sheets("Data").Range("B" &amp; i + 3).Value2 &amp; ".pdf"    
              ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=myPDF, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
      i = i + 1
       Next counter
  
  End Sub
  </code></pre>
  
  <p>Thanks!</p>