Hi all, I was able to solve it in a way. Here is the code for anyone wanting to do a chart with boxes and error bars
min = WorksheetFunction.min(Range("P2:P7"))
maxtmp = WorksheetFunction.max(Range("P2:P7"))
Q1tmp = WorksheetFunction.Quartile(Range("P2:P7"), 1)
Q3tmp = WorksheetFunction.Quartile(Range("P2:P7"), 3)
max = maxtmp - Q3tmp
Q1 = Q1tmp - min
Q3 = Q3tmp - Q1tmp
whiskerp = maxtmp - Q3tmp
whiskerm = Q1tmp - min
With myChart.Chart
With .SeriesCollection.NewSeries
.Name = "Median"
.Values = ws.Range("F9:F9") ' median
.ChartType = xlXYScatter
.MarkerStyle = 3
End With
With .SeriesCollection.NewSeries 'min
.Name = "min"
.Values = min
.ChartType = xlColumnStacked
.Format.Fill.Visible = msoFalse
End With
With .SeriesCollection.NewSeries 'Q1
.Name = "Q1"
.Values = Q1
.ErrorBar Direction:=xlY, Include:=xlMinusValues, Type:=xlCustom, Amount:=whiskerp, MinusValues:=whiskerm
.ChartType = xlColumnStacked
.Format.Fill.Visible = msoFalse
End With
With .SeriesCollection.NewSeries 'Q3
.Name = "Q3"
.Values = Q3
.ErrorBar Direction:=xlY, Include:=xlPlusValues, Type:=xlCustom, Amount:=whiskerp
.ChartType = xlColumnStacked
End With
End With
Bookmarks