I am beginner user of VBA, and I am trying to make a macro for work. I need to create one that takes a large amount of data in order to create 4 pivot charts and tables. Right now, I am having a problem with the code for creating a horizontal axis. I recorded the macro, but I keep getting this run-time error '424' Object required. The code in red is where I'm having a problem. Any help would be great. Thanks
End With
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Chart 1").Height = 480.24
ActiveSheet.Shapes("Chart 1").Width = 488.88
Application.CommandBars("Format Object").Visible = False
ActiveChart.SetElement (msoElementPrimaryValueAxisTitleAdjacentToAxis)
ActiveWindow.SmallScroll Down:=9
ActiveWorkbook.ShowPivotTableFieldList = False
ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Text = "Number of Breaks"
Selection.Format.TextFrame2.TextRange.Characters.Text = "Number of Breaks"
With Selection.Format.TextFrame2.TextRange.Characters(1, 16).ParagraphFormat
.TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter
End With
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Chart 1").Height = 480.24
ActiveSheet.Shapes("Chart 1").Width = 488.88
Application.CommandBars("Format Object").Visible = False
ActiveChart.SetElement (msoElementPrimaryValueAxisTitleAdjacentToAxis)
ActiveWindow.SmallScroll Down:=9
ActiveWorkbook.ShowPivotTableFieldList = False
ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Text = "Number of Breaks"
Selection.Format.TextFrame2.TextRange.Characters.Text = "Number of Breaks"
With Selection.Format.TextFrame2.TextRange.Characters(1, 16).ParagraphFormat
.TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter