Is there a way to create a shortcut key for Data, Calculate, formula to value?
This can be done using the standard mechanism. Select a convenient hotkey and specify
Functions: Formula to Value
Assign OK
formula to value does not show in functions list
Version: 26.2.5.2 (X86_64)
Build ID: cd7284b4cbbfeb507e630c1aac019f4157393acb
CPU threads: 6; OS: Windows 10 X86_64 (build 19045); UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL threaded
Thank You. It must have been the key I was trying to assign it to.
I wouldn’t recommend that way.
It only works as expected for a single selection.
In case of a multiselection, however, it does neither report a problem nor simply refuse action.
It applies the conversion to the focus cell in that case.
Danger of confusion / unnoticed changes.
Select the area or cell, and run the macro below, to make it easier, link the macro in a Menu.
Sub FormulaForValue
CreateUnoService("com.sun.star.frame.DispatchHelper").executeDispatch(ThisComponent.CurrentController.Frame, ".uno:ConvertFormulaToValue", "", 0, Array())
End Sub 'FormulaForValue
F2, F9, Enter, Enter
A real solution still requires to work with user code, imo.
The attached example contains the code for the conversion.
Since a selection of cells in Calc can be represented by three different types of objects (SheetCell, SheetCellRange, SheetCellRanges) I also provide a helper function unifying this under the third case.
disask_136704_ReplaceFormulasByResults.ods (33.5 KB)
See also topic 93400 (partly outdated). Prefer the soluition presented here.
