excel vba - VBA Creat chart based on pass/fail criteria -


I have a code that creates a scatter plot (a column vs. time data). There is a third column that states whether the data is "passed" or "unsuccessful" (data comes through a group of samples going through the test).

I am thinking, there is an algorithm which is called through the third column, and if it says "passed" or "unsuccessful", then does it connect the data and cells at that time, the series Are the offsets in the same line? There will be two series: one to pass another one to pass. X is the time value and y values ​​are data.

My code is already written, to create a chart with this series and how it finds the limit of data (dynamically changes):

  sub-addcharts ( ) Dim TSht as worksheet dim chat with the charts as the chart 'Find the last row in the data LRO ='. = Chat with .Shapes.AddChart.Cht.Chart .CharType = xlXYScatter .SeriesCollection.NewSeries.SeriesCollection (1) .XValues ​​= TSht.Range (Cell (2, 6), Room (LRow, 6)) . Price = TSht.Range (cells (2, 7), cells (LRO, 7)) with end and end end end and end    

sub-addcharts () as the dim TSht charts in the form of worksheet staining Cht, long range form In the form of the LR Range, the range as YP, Range as Wifi, Range range as YF Range, Range range, C range Set TSht = TSht with ActiveSheet 'data find the last row in LRow =. Bell (.ows.Count, 1). End (XLEEP). Pass / unsuccessful kernel 5 sets are in RNG = .resange (.csells (2, 5), .Cells (LRow, 5)) for each c rng.Cells c.Value = "pass" then addTo is in XP, C . Offset (0, 1) AddTo YP, c.Offset (0, 2) end then if c.Value = "unsuccessful" then addTo XF, c.Offset (0, 1) AddTo YF, c.Offset (0, 2) ) Finish the next C 'Cht .ChartType = xlXYScatter .SeriesCollection.NewSeries .Name = "Pass" .xValues ​​= xP .Values ​​= Create the chart set Cht = .hapes.AddChart.Chart along with the YP end. SeriesCollection.NewSeries .Name = "Fail" with .XValues ​​= XF .Values ​​= YF End X and Y Sub AddTo (RNG Range, RangeAdd as the boundary) for the construction of the end sub With the utility sub end ending with RNG nothing is set to RNG again, then = rngAdd Set RNG = Other Union (RNG, RNGED) end if and end

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -