Hello xld,
the data looks like this
Capture2.jpg
and I already changed the VBA code. However, the chart resulted from the code is not consistent. I dont know where went wrong.
Sub chart()
'Dim TheChart As chart
'Dim MySheets As Sheets
Dim begindate As Date
ActiveSheet.Shapes.AddChart(xlBarStacked).Select
begindate = Range("B2")
With ActiveChart.SeriesCollection.NewSeries
.XValues = ActiveSheet.Range("A2:A4")
.Name = ActiveSheet.Range("D1")
.Values = ActiveSheet.Range("D2:D4")
End With
With ActiveChart.SeriesCollection.NewSeries
.XValues = ActiveSheet.Range("A2:A4")
.Name = ActiveSheet.Range("F1")
.Values = ActiveSheet.Range("F2:F4")
End With
With ActiveChart
.HasTitle = True
.ChartTitle.Text = "Scheduling"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Text = Range("A1")
.Axes(xlCategory).ReversePlotOrder = True
.Axes(xlValue).MajorGridlines.Delete
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Text = "Date"
.Axes(xlValue, xlPrimary).TickLabels.NumberFormat = "d-mm-yy"
.Axes(xlValue, xlPrimary).MinimumScale = begindate
.SeriesCollection(1).Interior.ColorIndex = xlNone
.Legend.Delete
End With
End Sub
Thanks!