Sub ðàñ÷åò_òðåíäà() Dim a1, a2 As Long Dim a, b On Error Resume Next For a = 1 To 14 a1 = Application.Max(Range(Cells(7, a + 227), Cells(20, a + 227))) a1 = Range(Cells(7, a + 227), Cells(20, a + 227)).Find(What:=a1).Row Cells(a + 5, 260).Value = WorksheetFunction.Index(Application.LinEst(Range(Cells(7, a + 243), Cells(a1, a + 243)), Range(Cells(7, a + 227), Cells(a1, a + 227))), 1) Cells(a + 5, 261).Value = WorksheetFunction.Index(Application.LinEst(Range(Cells(7, a + 243), Cells(a1, a + 243)), Range(Cells(7, a + 227), Cells(a1, a + 227))), 1, 2) Cells(a + 5, 262).Value = WorksheetFunction.Index(Application.LinEst(Range(Cells(7, a + 243), Cells(a1, a + 243)), Range(Cells(7, a + 227), Cells(a1, a + 227)), , 1), 3, 1) Next a For b = 1 To 4 a2 = Application.Max(Range(Cells(7, b + 227), Cells(20, b + 227))) a2 = Range(Cells(7, b + 227), Cells(20, b + 227)).Find(What:=a2).Row Cells(b + 5, 264).Value = WorksheetFunction.Index(Application.LinEst(Range(Cells(7, b + 243), Cells(a2, b + 243)), Application.Ln(Range(Cells(7, b + 227), Cells(a2, b + 227)))), 1) Cells(b + 5, 265).Value = WorksheetFunction.Index(Application.LinEst(Range(Cells(7, b + 243), Cells(a2, b + 243)), Application.Ln(Range(Cells(7, b + 227), Cells(a2, b + 227)))), 1, 2) Cells(b + 5, 266).Value = WorksheetFunction.Index(Application.LinEst(Range(Cells(7, b + 243), Cells(a2, b + 243)), Application.Ln(Range(Cells(7, b + 227), Cells(a2, b + 227))), , 1), 3, 1) Next b End Sub
[/vba]
[vba]
Код
Sub ðàñ÷åò_òðåíäà() Dim a1, a2 As Long Dim a, b On Error Resume Next For a = 1 To 14 a1 = Application.Max(Range(Cells(7, a + 227), Cells(20, a + 227))) a1 = Range(Cells(7, a + 227), Cells(20, a + 227)).Find(What:=a1).Row Cells(a + 5, 260).Value = WorksheetFunction.Index(Application.LinEst(Range(Cells(7, a + 243), Cells(a1, a + 243)), Range(Cells(7, a + 227), Cells(a1, a + 227))), 1) Cells(a + 5, 261).Value = WorksheetFunction.Index(Application.LinEst(Range(Cells(7, a + 243), Cells(a1, a + 243)), Range(Cells(7, a + 227), Cells(a1, a + 227))), 1, 2) Cells(a + 5, 262).Value = WorksheetFunction.Index(Application.LinEst(Range(Cells(7, a + 243), Cells(a1, a + 243)), Range(Cells(7, a + 227), Cells(a1, a + 227)), , 1), 3, 1) Next a For b = 1 To 4 a2 = Application.Max(Range(Cells(7, b + 227), Cells(20, b + 227))) a2 = Range(Cells(7, b + 227), Cells(20, b + 227)).Find(What:=a2).Row Cells(b + 5, 264).Value = WorksheetFunction.Index(Application.LinEst(Range(Cells(7, b + 243), Cells(a2, b + 243)), Application.Ln(Range(Cells(7, b + 227), Cells(a2, b + 227)))), 1) Cells(b + 5, 265).Value = WorksheetFunction.Index(Application.LinEst(Range(Cells(7, b + 243), Cells(a2, b + 243)), Application.Ln(Range(Cells(7, b + 227), Cells(a2, b + 227)))), 1, 2) Cells(b + 5, 266).Value = WorksheetFunction.Index(Application.LinEst(Range(Cells(7, b + 243), Cells(a2, b + 243)), Application.Ln(Range(Cells(7, b + 227), Cells(a2, b + 227))), , 1), 3, 1) Next b End Sub