1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Sub Penetration(Wb, NbInjectors)
Dim MyGraph As Chart, MySheet As Worksheet, TimeRange As Range, PenetrationRange As Range
Wb.Activate
NumberOfPressure = 2
'ReDim DataRange(0, NumberOfPressure - 1)
'\\\\\\\ Loop on the pressures
For Pressure = 0 To NumberOfPressure - 1
Set MyGraph = Wb.Charts.Add
MyGraph.ChartType = xlXYScatterSmooth
Stop
'\\\\\\\\ Loop on the injectors
For Injector = 0 To NbInjectors - 1
Set MySheet = Wb.Worksheets(Injector + 1)
With MySheet
Set TimeRange = .Range(.Cells(8, 2 + 12 * Pressure), .Cells(107, 2 + 12 * Pressure))
Set PenetrationRange = .Range(.Cells(8, 6 + 12 * Pressure), .Cells(107, 6 + 12 * Pressure))
End With
With MyGraph
'penetration of the injectors for ONE pressure
Set PenetrationSerie = .SeriesCollection.NewSeries
With PenetrationSerie
.AxisGroup = xlPrimary
.MarkerStyle = xlMarkerStyleNone
.Values = PenetrationRange
.XValues = TimeRange
.Name = MySheet.Cells(2, 3).Value
End With
End With
Next
Next
End Sub |