Function mQ(ByVal Q As Double, ByVal e As Double) Application.Volatile Dim i As Long, retv As Double, p As Double retv = 0 p = 1 - e e = 2 * e For i = 1 To 60 retv = retv + Q * (p + e * Rnd()) Next i mQ = retvEnd FunctionSub aga() Dim rng As Range, lpos As Single Const cntRow As Long = 24 * 30 ' 24 часа * 30 суток Set rng = ActiveSheet.Cells(1, 1) rng(1, 1) = "Q": rng(1, 2) = 100 rng(2, 1) = "err": rng(2, 2) = 5 rng(4, 1) = "Время" rng(4, 2) = "Объем V" rng(4, 3) = "Изм. объем V1" rng(4, 4) = "Абс. погр. Ea1" rng(4, 5) = "Отн. погр. Er1" rng(4, 6) = "Изм. объем V2" rng(4, 7) = "Абс. погр. Ea2" rng(4, 8) = "Отн. погр. Er2" rng(4, 9) = "Разница V1-V2" rng(4, 10) = "(V1-V2)/V*100" Range(rng(4, 1), rng(4, 10)).Columns.AutoFit rng.Rows(5).RowHeight = 4 rng(6, 1).FormulaR1C1 = "=R[-1]C+1" rng(6, 2).FormulaR1C1 = "=R[-1]C+R1C2*60" rng(6, 3).FormulaR1C1 = "=R[-1]C+mQ(R1C2,R2C2/100)" rng(6, 4).FormulaR1C1 = "=RC[-1]-RC2" rng(6, 5).FormulaR1C1 = "=RC[-1]/RC2*100" rng(6, 6).FormulaR1C1 = "=R[-1]C+mQ(R1C2,R2C2/100)" rng(6, 7).FormulaR1C1 = "=RC[-1]-RC2" rng(6, 8).FormulaR1C1 = "=RC[-1]/RC2*100" rng(6, 9).FormulaR1C1 = "=RC3-RC6" rng(6, 10).FormulaR1C1 = "=RC[-1]/RC2*100" Set rng = Range(rng(6, 1), rng(cntRow + 5, 10)) Range(rng(1, 1), rng(1, 10)).AutoFill Destination:=rng Charts.Add ActiveChart.ChartType = xlXYScatterLinesNoMarkers ActiveChart.SetSourceData Source:=Union(rng.Columns(1), _ rng.Columns(4), _ rng.Columns(7), _ rng.Columns(9)), _ PlotBy:=xlColumns ActiveChart.Location Where:=xlLocationAsObject, _ Name:=rng.Parent.Name ActiveChart.Legend.Position = xlBottom ActiveChart.Legend.Border.LineStyle = xlNone With ActiveChart.SeriesCollection(1) .Name = "Ea1" .Border.ColorIndex = 11: .Border.Weight = xlThick End With With ActiveChart.SeriesCollection(2) .Name = "Ea2" .Border.ColorIndex = 11: .Border.Weight = xlThick End With With ActiveChart.SeriesCollection(3) .Name = "V1-V2" .Border.ColorIndex = 4: .Border.Weight = xlThick End With ActiveChart.HasTitle = True ActiveChart.ChartTitle.Font.Size = 12 ActiveChart.ChartTitle.Font.Bold = True ActiveChart.ChartTitle.Characters.Text = "Абсолютная погрешность" ActiveChart.PlotArea.Interior.ColorIndex = xlNone ActiveChart.Parent.Left = 10 lpos = 20 + ActiveChart.Parent.Width Charts.Add ActiveChart.ChartType = xlXYScatterLinesNoMarkers ActiveChart.SetSourceData Source:=Union(rng.Columns(1), _ rng.Columns(5), _ rng.Columns(8), _ rng.Columns(10)), _ PlotBy:=xlColumns ActiveChart.Location Where:=xlLocationAsObject, _ Name:=rng.Parent.Name ActiveChart.Legend.Position = xlBottom ActiveChart.Legend.Border.LineStyle = xlNone With ActiveChart.SeriesCollection(1) .Name = "Er1" .Border.ColorIndex = 11: .Border.Weight = xlThick End With With ActiveChart.SeriesCollection(2) .Name = "Er2" .Border.ColorIndex = 11: .Border.Weight = xlThick End With With ActiveChart.SeriesCollection(3) .Name = "(V1-V2)/V*100" .Border.ColorIndex = 4: .Border.Weight = xlThick End With ActiveChart.HasTitle = True ActiveChart.ChartTitle.Font.Size = 12 ActiveChart.ChartTitle.Font.Bold = True ActiveChart.ChartTitle.Characters.Text = "Относительная погрешность" ActiveChart.PlotArea.Interior.ColorIndex = xlNone ActiveChart.Parent.Left = lpos ActiveChart.Deselect Set rng = NothingEnd Sub