libreoffice - Goal Seek in User Defined Function for Libre Office Basic -


I am trying to use Libre Office Basic to write user-defined functions for LibreOffice Calc Instead of running the function, I click on the menu and click

What I want to be able to do is pass a cell as the first argument for the formula, the second argument is that I I want to set up the formula, and the third argument is to be the cell Ahia which can be used to manipulate variables.

For example, I want to type in cell A3 in calc = GSeek2 (A1,5, A2) , where = A2 + 1 < / Code> and starts from A2 0 and 4 is equal to A3.

I think that there is a need to act as an address in order to manipulate formula and cell, but I'm not sure. I have tried the following code, but I'm getting "basic syntax error. Unexpected symbol: target." Does anyone know why I am going wrong?

  Function GSeek2 (form in the form of the form, double as the target, as the wise range) form = form. Var = Address.Address ("Sheet1") with Wordsheets GSeek2 =. Range (form). GoalSeek _ Goal: =. Value (target). Price, _ changing call: = Range (VAR) end with the end of the function  

OpenOffice Or libreoffice macro can not be written in VBA as in Excel. Your VBA code will not work. You have to work with special Basic Bid and OpenOffice or LibreOffice APIs. This is a good starting point for

Unfortunately you can not pass objects as arguments to user-defined functions in OpenOffice or LibreOffice. . If you can only pass an argument parts of a cell address (as sheets, column, row) are

Example:

  function GSeek2 (lSheetF long in lColF long as the time, long lRowF as, lSheetV as long as lColV as dTarget in the long run, as long, double lRwoV as) double new com in as dim oCellAddressFormula .sun.star.table.CellAddress oCellAddressFormula.Sheet = lSheetF-1 oCellAddressFormula.Column = lColF- 1 oCellAddressFormula.Row = lRowF-1 Okel Official Awesome as new comCom.un.star.table.CellAddress oCellAddressVaiable.Sheet = lSheetV-1 oCellAddressVaiable.Column = lColV-1 oCellAddressVaiable.Row = lRowV1-1 oGoalResult = This component. SeekGoal (oCellAddressFormula, oCellAddressVaiable, dTarget) GSeek2 = oGoalResult.Result End Function  as 

Using Cell

  = GSEEK2 (Sheet (A1 ), Column (A1), row (A1), sheet (A2), column (A2), row (A2), 5)  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -