[Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register]

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. TiksuLast edited by Tiksu on Wed Feb 02, 2011 8:06 am; edited 1 time in total
B Marcelly
Super User

Joined: 12 May 2004
Posts: 1453
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 / Apache OpenOffice 4.0.1 / LibreOffice 4.1.0 MS-Windows 7 Home SP1 This forum is spammed, use instead Apache OpenOffice forums
JohnV

Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

 Posted: Wed Feb 02, 2011 7:51 am    Post subject: Try Ctrl+Shift+F9.
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.
pitonyak

Joined: 09 Mar 2004
Posts: 3655
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
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 8 Hours Page 1 of 1

 Jump to: Select a forum OpenOffice.org Forums----------------Setup and TroubleshootingOpenOffice.org WriterOpenOffice.org CalcOpenOffice.org ImpressOpenOffice.org DrawOpenOffice.org MathOpenOffice.org BaseOpenOffice.org Macros and APIOpenOffice.org Code Snippets Community Forums----------------General DiscussionSite Feedback
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum