title: Object Required when trying to label y axis
body: <p>I am trying to use Excel Macros for the first time, but for some reason the corresponding VBA code doesn't like it when I try to label the y axis. I get a run time error 424, and then it says object required.</p>
  
  <pre><code>Sub Graphplotz()
  '
  ' Graphplotz Macro
  '
  
  '
  
      Range("A2:B15").Select
      ActiveSheet.Shapes.AddChart2(240, xlXYScatterSmooth).Select
      ActiveChart.SetSourceData Source:=Range("Plot!$A$2:$B$15")
      ActiveChart.ChartTitle.Select
      Selection.Format.TextFrame2.TextRange.Characters.Text = _
          "Stress vs. Deformation"
      With Selection.Format.TextFrame2.TextRange.Characters(1, 22).ParagraphFormat
          .TextDirection = msoTextDirectionLeftToRight
          .Alignment = msoAlignCenter
      End With
      With Selection.Format.TextFrame2.TextRange.Characters(1, 6).Font
          .BaselineOffset = 0
          .Bold = msoFalse
          .NameComplexScript = "+mn-cs"
          .NameFarEast = "+mn-ea"
          .Fill.Visible = msoTrue
          .Fill.ForeColor.RGB = RGB(89, 89, 89)
          .Fill.Transparency = 0
          .Fill.Solid
          .Size = 14
          .Italic = msoFalse
          .Kerning = 12
          .Name = "+mn-lt"
          .UnderlineStyle = msoNoUnderline
          .Spacing = 0
          .Strike = msoNoStrike
      End With
      With Selection.Format.TextFrame2.TextRange.Characters(7, 16).Font
          .BaselineOffset = 0
          .Bold = msoFalse
          .NameComplexScript = "+mn-cs"
          .NameFarEast = "+mn-ea"
          .Fill.Visible = msoTrue
          .Fill.ForeColor.RGB = RGB(89, 89, 89)
          .Fill.Transparency = 0
          .Fill.Solid
          .Size = 14
          .Italic = msoFalse
          .Kerning = 12
          .Name = "+mn-lt"
          .UnderlineStyle = msoNoUnderline
          .Spacing = 0
          .Strike = msoNoStrike
      End With
      ActiveChart.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
      Selection.Format.TextFrame2.TextRange.Characters.Text = "Deformation"
      With Selection.Format.TextFrame2.TextRange.Characters(1, 11).ParagraphFormat
          .TextDirection = msoTextDirectionLeftToRight
          .Alignment = msoAlignCenter
      End With
      With Selection.Format.TextFrame2.TextRange.Characters(1, 11).Font
          .BaselineOffset = 0
          .Bold = msoFalse
          .NameComplexScript = "+mn-cs"
          .NameFarEast = "+mn-ea"
          .Fill.Visible = msoTrue
          .Fill.ForeColor.RGB = RGB(89, 89, 89)
          .Fill.Transparency = 0
          .Fill.Solid
          .Size = 10
          .Italic = msoFalse
          .Kerning = 12
          .Name = "+mn-lt"
          .UnderlineStyle = msoNoUnderline
          .Strike = msoNoStrike
      End With
      ActiveChart.SetElement (msoElementPrimaryValueAxisTitleAdjacentToAxis)
      ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Text = "Stress(Mpa)"
      Selection.Format.TextFrame2.TextRange.Characters.Text = "Stress(Mpa)"
      With Selection.Format.TextFrame2.TextRange.Characters(1, 11).ParagraphFormat
          .TextDirection = msoTextDirectionLeftToRight
          .Alignment = msoAlignCenter
      End With
      With Selection.Format.TextFrame2.TextRange.Characters(1, 11).Font
          .BaselineOffset = 0
          .Bold = msoFalse
          .NameComplexScript = "+mn-cs"
          .NameFarEast = "+mn-ea"
          .Fill.Visible = msoTrue
          .Fill.ForeColor.RGB = RGB(89, 89, 89)
          .Fill.Transparency = 0
          .Fill.Solid
          .Size = 10
          .Italic = msoFalse
          .Kerning = 12
          .Name = "+mn-lt"
          .UnderlineStyle = msoNoUnderline
          .Strike = msoNoStrike
      End With
      Range("L7").Select
  End Sub
  </code></pre>