This is my chart creating macro.
I want to change some parameters of the graph, but get an error:
Automation error
Whre is my mistake?
I want to change some parameters of the graph, but get an error:
Automation error
Code:
Sub CreateChart()
Dim jS As Worksheet
Dim jRow As Long
Dim jChart As Chart
Dim jChartRange As Range
Set jS = ActiveSheet
Range("A2:B2").Select
Set jChartRange = Range("A2:B2", Selection.End(xlDown))
Set jChart = Charts.Add
jChart.ChartType = xlLineMarkers
jChart.SetSourceData Source:=jChartRange, PlotBy:=xlColumns
jChart.Location Where:=xlLocationAsObject, Name:=jS.Name
With jChart
.HasTitle = False
.Parent.Top = 15
.Parent.Left = 200
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
.HasLegend = False
.HasDataTable = False
End With
End Sub
Whre is my mistake?