Code: Select all
Sub regressao
svc = createUnoService( "com.sun.star.sheet.FunctionAccess" )
dim rend ( 1 to 3 ) as double
dim y ( 1 to 3 ) as double
dim coef as double
oDoc = thisComponent
oForm2 = oDoc.DrawPage.Forms.getByName("MainForm").getbyname("SubForm").getbyname("gridace")
rend(1) = oForm2.RowSet.Columns.getbyname("Rend50").value
rend(2) = oForm2.RowSet.Columns.getbyname("Rend75").value
rend(3) = oForm2.RowSet.Columns.getbyname("Rend100").value
y(1) = 0.5
y(2) = 0.75
y(3) = 1
result = svc.callFunction( "LINEST", y, rend )
End SubThe result if doing in calc would be something like this(CTRL + SHIFT + ENTER):
And then I'm going to commit those two bolded values to a table for further calculations
2090,531693 2715,334385
570,8920868 863,3916473
0,770237485 1041,892876
13,40928019 4
14556320,27 4342163,06