A
Alan
Any idea what this error means? It occurs at the following line in my
code in subroutine "CreateWPMchart""
ActiveChart.SeriesCollection(3).Select
I am running the subroutine FixAndCreateCharts() on a CSV file. The
most relevant code may be found below.
Thanks, Alan
Sub FixAndCreateCharts()
ActiveCell.Columns("A:G").EntireColumn.Select
Selection.ColumnWidth = 17.71
ActiveCell.Rows("1:1").EntireRow.Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
FormatPageFileByte
Call CreateWPMchart("A:A,C:C,E:E,G:G", "CPU Utilization", "% Processor
Time")
End Sub
Sub FormatPageFileByte()
ActiveCell.Range("B:B,D,F:F").Select
Selection.NumberFormat = "0.00E+00"
End Sub
Sub CreateWPMchart(ColumnRange As String, ChartName As String,
yAxisTitle As String)
Worksheets("FIXED_PerfWiz - 5 second Interv").Activate
Charts.Add
ActiveChart.ChartType = xlLineMarkers
MsgBox ("In CreateWPMchart - prior to chart creation, Column Range: "
& ColumnRange)
ActiveChart.SetSourceData Source:=Sheets("FIXED_PerfWiz - 5 second
interv"). _
Range(ColumnRange), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:=ChartName
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = ChartName
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = _
"Time (5 sec. intervals)"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text =
yAxisTitle
End With
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
ActiveChart.HasDataTable = False
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(3).Select
With Selection.Border
.ColorIndex = 10
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection
.MarkerBackgroundColorIndex = 10
.MarkerForegroundColorIndex = 10
.MarkerStyle = xlTriangle
.Smooth = False
.MarkerSize = 5
.Shadow = False
End With
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(2).Select
With Selection.Border
.ColorIndex = 9
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection
.MarkerBackgroundColorIndex = 9
.MarkerForegroundColorIndex = 9
.MarkerStyle = xlSquare
.Smooth = False
.MarkerSize = 5
.Shadow = False
End With
End Sub
code in subroutine "CreateWPMchart""
ActiveChart.SeriesCollection(3).Select
I am running the subroutine FixAndCreateCharts() on a CSV file. The
most relevant code may be found below.
Thanks, Alan
Sub FixAndCreateCharts()
ActiveCell.Columns("A:G").EntireColumn.Select
Selection.ColumnWidth = 17.71
ActiveCell.Rows("1:1").EntireRow.Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
FormatPageFileByte
Call CreateWPMchart("A:A,C:C,E:E,G:G", "CPU Utilization", "% Processor
Time")
End Sub
Sub FormatPageFileByte()
ActiveCell.Range("B:B,D,F:F").Select
Selection.NumberFormat = "0.00E+00"
End Sub
Sub CreateWPMchart(ColumnRange As String, ChartName As String,
yAxisTitle As String)
Worksheets("FIXED_PerfWiz - 5 second Interv").Activate
Charts.Add
ActiveChart.ChartType = xlLineMarkers
MsgBox ("In CreateWPMchart - prior to chart creation, Column Range: "
& ColumnRange)
ActiveChart.SetSourceData Source:=Sheets("FIXED_PerfWiz - 5 second
interv"). _
Range(ColumnRange), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:=ChartName
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = ChartName
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = _
"Time (5 sec. intervals)"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text =
yAxisTitle
End With
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
ActiveChart.HasDataTable = False
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(3).Select
With Selection.Border
.ColorIndex = 10
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection
.MarkerBackgroundColorIndex = 10
.MarkerForegroundColorIndex = 10
.MarkerStyle = xlTriangle
.Smooth = False
.MarkerSize = 5
.Shadow = False
End With
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(2).Select
With Selection.Border
.ColorIndex = 9
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection
.MarkerBackgroundColorIndex = 9
.MarkerForegroundColorIndex = 9
.MarkerStyle = xlSquare
.Smooth = False
.MarkerSize = 5
.Shadow = False
End With
End Sub