Page 1 of 1

[Solved] How to get a cell value in the edit mode in Calc

Posted: Fri Dec 25, 2020 7:11 am
by eeigor
How can I get a new active cell value that hasn't been saved yet?
The user entered a value in the edit mode, but did not exit the cell.

If I'm not mistaken, in Excel this cell property is called "Text" (ActiveCell.Text).

Re: How to get a cell value in the edit mode in Calc

Posted: Fri Dec 25, 2020 9:03 am
by Zizi64
The user entered a value in the edit mode, but did not exit the cell.
And what about the hitting Enter key?

If the entered value has not been accepted, then the value is not assigned to the active cell. It is stored only in a temporary buffer somewhere... (I do not know how, and where from you can get it)

When the value has been accepted by the Enter key or by leaving the cell, then you will able get the (textual or numeric) value FROM the cell.

Re: How to get a cell value in the edit mode in Calc

Posted: Fri Dec 25, 2020 9:45 am
by eeigor
Alas, no. It is necessary to take the value from the buffer, if there is no corresponding property.
In any case, thank you for your feedback.
But maybe @Villeroy will respond and offer a solution?

Re: How to get a cell value in the edit mode in Calc

Posted: Fri Dec 25, 2020 9:54 am
by Zizi64
Have you tried to use the InputBox in your macro? By usage of the InputBox you can get the entered value BEFORE you assign it to a cell.

Re: How to get a cell value in the edit mode in Calc

Posted: Fri Dec 25, 2020 10:07 am
by eeigor
Yes, that's what I just wrote about.
"I need to extend the entered value to other cells. But if the solution is cumbersome, then it is probably better to run the procedure before entering and accept the value via the InputBox() function."

But let's wait a bit…

UPD:
However, the value is a formula, and it would be better to write it in the formula bar…

Re: How to get a cell value in the edit mode in Calc

Posted: Fri Dec 25, 2020 10:50 am
by Zizi64
However, the value is a formula, and it would be better to write it in the formula bar…
You can set the
- Value (numeric)
- Text (string)
- Formula (English like)
- Formulalocal (localized formula)
of a cell by your macro code.

Here are some samples from Villeroy - of course - :
viewtopic.php?f=75&t=76258
viewtopic.php?f=20&t=17428

Re: How to get a cell value in the edit mode in Calc

Posted: Fri Dec 25, 2020 1:49 pm
by eeigor
The question is removed, I was wrong.