Hi
I have got this piece of code to work for one series.
How can i have multiple series?
The data it uses for x and y will be the same columns but I want to have it so it theres two different "system-names" in another column both "system-names" will have a series on the graph
I have got this piece of code to work for one series.
How can i have multiple series?
The data it uses for x and y will be the same columns but I want to have it so it theres two different "system-names" in another column both "system-names" will have a series on the graph
Code:
Sub CreateGraph()
'creating graph
Dim LstRw As Long, crng As Range, x As Range, y As Range
LstRw = Sheets("Filter").Range("D" & Rows.Count).End(xlUp).Row
Set x = Sheets("Filter").Range("D6:D" & LstRw)
Set y = Sheets("Filter").Range("K6:K" & LstRw)
Dim cht As Object
Set cht = ThisWorkbook.Sheets("Chart1")
'Your data range for the chart
'Give chart some data
cht.SeriesCollection(1).XValues = y
cht.SeriesCollection(1).Values = x
'Determine the chart type
cht.ChartType = xlXYScatterLines
'Ensure chart has a title
cht.HasTitle = True
'system name
sysnm = Sheets("Master").Range("B11").Value
'Change chart's title
cht.ChartTitle.Text = sysnm & " EOD Run Time Analysis"
'Change chart's x-axis
cht.Axes(xlCategory, xlPrimary).HasTitle = True
cht.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Date"
'Change chart's y-axis
cht.Axes(xlValue, xlPrimary).HasTitle = True
cht.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Run Time (mins)"
End Sub