| View previous topic :: View next topic |
| Author |
Message |
Tiksu General User

Joined: 31 Dec 2010 Posts: 48
|
Posted: Wed Feb 02, 2011 3:44 am Post subject: [Almost solved]Recalculating your own function |
|
|
How could i get my own function recalculated when the values in the source table change?
Let's say that i want to sum the values in col and row positions col1, row1 and col2, row2 and i write a function that does it. Here, i need to use the "basic way" to refer to the cell, ie. integer colNo and integer rowNo.
The result is correct when i type in the function in first time. It is also correct when the source values are changed and i copy paste the function to another cell but the function in the original cell remains unchanged.
The problem is that i cannot tell calc to recalculate the original function in the original cell. If i add some spaces in the function call in the original cell and hit return, the function is recalculated, but that does not seem as an elegant way.
Recalculate ie. F9 does not help.
Tiksu
Last edited by Tiksu on Wed Feb 02, 2011 8:06 am; edited 1 time in total |
|
| Back to top |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1414 Location: France
|
Posted: Wed Feb 02, 2011 4:54 am Post subject: |
|
|
Hi,
That is normal. You are not following the philosophy of calc functions.
In a Basic function for Calc you should never directly address a cell. Or you will get problems like this one.
A Basic function for Calc should work from its arguments and only return a value (Double or String). An argument may be a cell range, then you get an array of values but not the address of the cell range. A correct Basic function for Calc is independent of the position of the cells.
Another solution to your problem may be a Basic routine run when you need it, by clicking a button for example. The routine then recalculates any cells you want, and even do other things (formatting, message, etc). _________________ Bernard
OpenOffice.org 1.1.5 fr / OpenOffice.org 3.4.1 en-US + langpacks, MS-Windows XP Home SP3
This forum is unusable, use instead Apache OpenOffice forums |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8976 Location: Lexinton, Kentucky, USA
|
Posted: Wed Feb 02, 2011 7:51 am Post subject: |
|
|
| Try Ctrl+Shift+F9. |
|
| Back to top |
|
 |
Tiksu General User

Joined: 31 Dec 2010 Posts: 48
|
Posted: Wed Feb 02, 2011 8:13 am Post subject: |
|
|
Thank you for the hints!
It seems that
| JohnV wrote: | | Try Ctrl+Shift+F9. |
helps. I get the functions recalculated by pressing Ctrl+Shift+F9. In Basic, could it mean calculateAll. |
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3618 Location: Columbus, Ohio, USA
|
Posted: Mon Feb 14, 2011 8:59 pm Post subject: |
|
|
Note that if you write a Calc function that is called as a calc function, you cannot directly modify any cells on the same sheet used to call the function. Doing otherwise is dangerous and should be expected to fail. it is not clear to me that this is what you mean, however.... Just wanted to mention it. _________________ --
Andrew Pitonyak
http://www.pitonyak.org/oo.php |
|
| Back to top |
|
 |
|