Sub CreateChart()
Dim ser As Series
Dim WString As String
Worksheets("Product Search 2").Shapes.AddChart.Select
ActiveChart.ChartType = xlLineMarkers
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Text = "Time plot of price (£/kg)"
ActiveChart.ChartTitle.Font.Size = 25
For i = ActiveChart.SeriesCollection.Count To 1 Step -1
ActiveChart.SeriesCollection(i).Delete
Next i
Set ser = ActiveChart.SeriesCollection.NewSeries
With ser
.XValues = AL
.Values = AM
End With
With ActiveChart
With .Axes(xlCategory, xlPrimary)
.CategoryType = xlTimeScale
.TickLabels.NumberFormat = "dd/mmm/yyyy"
.TickLabels.Font.Size = 22
.HasTitle = True
.AxisTitle.Characters.Text = "Date"
.AxisTitle.Font.Size = 25
.MajorUnitScale = xlMonths
.MajorUnit = 4
End With
With .Axes(xlValue, xlPrimary)
.TickLabels.Font.Size = 22
.HasTitle = True
.AxisTitle.Characters.Text = "Price (£/kg)"
.AxisTitle.Font.Size = 25
End With
End With
With ActiveChart.Parent
.Left = 20
.Width = 800
.Top = 1850
.Height = 1000
End With
With ActiveChart.PlotArea
.Left = 10
.Width = 700
.Height = 800
.Top = 89
End With
End Sub
Bookmarks