Ask Your Question
0

macro overlays formula in cell [closed]

asked 2012-11-01 02:07:34 +0200

Ron gravatar image

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?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-10-18 22:25:41.651387

1 Answer

Sort by » oldest newest most voted
2

answered 2012-11-01 04:53:26 +0200

m.a.riosv gravatar image

updated 2012-11-01 04:53:52 +0200

I think, maybe you do not need to save the result in the cell, if the macro function MyMacro() return a value, that's all, like any other function.

Function sample in LibreOffice help:

Function VOL(a, b, c)

VOL = abc

End Function

edit flag offensive delete link more

Comments

SOLVED - thank you

Ron gravatar imageRon ( 2012-11-02 23:13:48 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2012-11-01 02:07:34 +0200

Seen: 343 times

Last updated: Nov 01 '12