Hello Everyone,
I am new to the forum and VBA coding. I have created some code that is to plot a series of data in an XY Scatter plot. However, when I run the code it plots additional series on the plot that I have not asked the code to plot.
A small portion of the code is below, which draws the first chart on the worksheet. The additional number of series is much higher on worksheets Plate w Hole 1 and above. I have attached a copy of the workbook as well. The entire code will not run on most computers because it is communicating with another piece of software. However the graph drawing is in the post processing stage of my analysis and only occurs within Excel.
Sub InitialAnalysis()
If ActiveSheet.ChartObjects.Count <> 0 Then
ActiveSheet.ChartObjects.Delete
End If
'First create the plot of the K1 values as a function of extraction point number
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatter
With ActiveChart
.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = ActiveSheet.Range("$H$25:$H$266")
.SeriesCollection(1).Values = ActiveSheet.Range("$L$25:$L$266")
.Axes(xlCategory).HasTitle = True
.Axes(xlCategory).AxisTitle.Caption = "Extraction Point Number"
.Axes(xlValue).HasTitle = True
.Axes(xlValue).AxisTitle.Caption = "Stress Intensity Factor (psi(in)^(0.5))"
.Axes(xlValue).MinimumScale = 400
ActiveSheet.Shapes(1).Left = ActiveSheet.Cells(22, 28).Left
ActiveSheet.Shapes(1).Top = ActiveSheet.Cells(22, 28).Top
ActiveSheet.Shapes(1).Height = ActiveSheet.Range("AI22:AI35").Height
ActiveSheet.Shapes(1).Width = ActiveSheet.Range("AB35:AI35").Width
End With
Attachment 166414
Bookmarks