How do you set the start value of the category axis?
All I want to do is set the start value to a variable in my code (WeekSNum) and have it increment by 1 for each point on the axis.
I can't seem to get it to work. I can either get it to go from 1 to 17 which in the test I'm using is incorrect, or from 7 to 24, which is correct on the labels, but then it cuts off all plot points from 1 to 6 and doesn't have any past 17.
anyway here is my code with all the relevant bits.
where WeekSNum = 7 and X = 17
Just to clarify all I want is for the first point on the X-axis to be labelled as the value for WeekSNum. I don't actually want the 7th value. Just the labelling.
All I want to do is set the start value to a variable in my code (WeekSNum) and have it increment by 1 for each point on the axis.
I can't seem to get it to work. I can either get it to go from 1 to 17 which in the test I'm using is incorrect, or from 7 to 24, which is correct on the labels, but then it cuts off all plot points from 1 to 6 and doesn't have any past 17.
anyway here is my code with all the relevant bits.
Code:
Sheets("Sheet2").Shapes.AddChart.Select
r = 1
C = 2
With ActiveChart
.Parent.Name = ws2.Range("A1").Offset(Y - 1, 0)
.Parent.Width = 800
.Parent.Height = 400
.ChartType = xlLine
.SetSourceData Source:=wsm.Range("C1:C" & X)
.SeriesCollection(1).Name = ws2.Range("C3")
.HasTitle = True
.ChartTitle.Text = ws2.Range("A1").Offset(Y - 1, 0)
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Text = (DF - 6) & " to " & DT
.Axes(xlCategory).AxisBetweenCategories = False
.Axes(xlCategory, xlPrimary).CategoryType = xlTimeScale
.Axes(xlCategory, xlPrimary).MinimumScale = WeekSNum
.Axes(xlCategory, xlPrimary).MaximumScale = WeekSNum + X
.Axes(xlValue).MajorGridlines.Delete
Do Until r = 10
.SeriesCollection.NewSeries
.SeriesCollection(C).Values = wsm.Range("C1:C" & X).Offset(0, r)
.SeriesCollection(C).Name = ws2.Range("C3").Offset(0, r + r)
r = r + 1
C = C + 1
Loop
End With
End Sub
where WeekSNum = 7 and X = 17
Just to clarify all I want is for the first point on the X-axis to be labelled as the value for WeekSNum. I don't actually want the 7th value. Just the labelling.