https://bugs.documentfoundation.org/show_bug.cgi?id=81757

--- Comment #23 from Eike Rathke <er...@redhat.com> ---
The moment you observed Err:522 you should had gotten suspicious.. the culprit
is the macro that while it has a CalculateHard running that calculates
BENDALLOWANCE() that modifies the cell content of J12, which for the current
view area triggers a find for changed values and calculates formula cells that
are set "dirty" (i.e. to be recalculated), which then for F8 wants to obtain
the result of F7 that currently is already running, hence the circular
reference.

0. best do not try such dirty tricks as modifying cell content in a formula
cell's macro function. It may work or may not and may have side effects you
aren't aware of. As seen.

1. take such Err:522 circular reference error serious if you do such thing and
not expect it (i.e. the formula cells and the cell references they use are not
circular); just switching on iterations to workaround and suppress it may just
hide the cause and fool you with an unexpected result. As seen.

2. if you feel brave and want to do such nasty things anyway then switch off
all updates while the recalc executes to not have the "update the screen from
dirty values and thus recalculate" triggered, i.e. in your sub recalcul lock
and unlock the controllers with

dim component as object
component = ThisComponent
component.lockControllers()
... CalculateHard ...
component.unlockControllers()

which in this case works.

However, the better solution would be to not have the macro functions fiddle
with cell content at all but rather calculate J12 properly with another
function. Also, it would be better to not have the listboxes trigger a
CalculateHard on selection, but rather write the selection to a cell (or use
Data Validity instead of a form listbox) and use that cell as parameter to
functions. You wouldn't need any manual recalc then.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to