PDA

View Full Version : [SOLVED:] Trouble Assigning Error Bars with Array



IgnorantBlis
08-07-2019, 07:56 AM
Hello,

I am in the process of a new project and the only thing holding me back at this time is the creation of Error bars on a chart. I have tried multiple different ways of assigning the error bars and all create an error. k is previously assigned a value and is equal to 2 in this situation. Code below:



Set rng2 = .Range(.Cells(6, 1), .Cells(6, k))
valueArray2 = rng2

Charts("BoxWhiskerPlot").Activate
ActiveChart.ChartArea.ClearContents


ActiveChart.SeriesCollection.NewSeries
With ActiveChart.SeriesCollection(1)
.Values = valueArray1
.XValues = Array(xArray)
.ErrorBar Direction:=xlY, Include:=xlErrorBarIncludeMinusValues, Type:=xlErrorBarTypeFixedValue, _ Amount:=valueArray2
.Format.Fill.Visible = msoFalse
.Format.Line.Visible = msoFalse
End With


This code works perfectly when only one value has to be pulled from the array or range. Its flaw is when pulling the second value to assign the amount. I tried using MinusValues:=[blah blah] and that failed. While watching the valueArray2, it does show the two correct values, however it fails to assign them to the error bar. I think I might just be missing something in terms of the syntax or appropriate value types to be used.

Any help is appreciated.