When a cell is selected and it contains a formula, Calc by default shows the formula in the formula bar and the calculation result in the cell.
But when I code =MyMacro() in a cell and MyMacro() saves a result in the cell with thisComponent.currentController.selection.setValue(result) the formula is overwritten with the result and the call to MyMacro() is lost. The result displays in both the selected cell and in the formula bar.
What did I do wrong or fail to do?