Description: Hi, I noted that Round is not yet implemented in Basic, so, you can rounded a cell in calc, but you can't get the same value from Basic. May be it could be implemented soon in newest versions. Actual Results: You simplement can't use the function Expected Results: Rounded a value to 1, 2, 3 or desired decimal precision. Reproducible: Always User Profile Reset: No Additional Info: User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
Sounds sensible -> NEW
Round() is available only in the VBA compatibility mode, which you can enable using "Option Compatible" or "Option VBASupport 1". Is it better to have it in the normal mode too?
In reply to Takeshi Abe from comment #2) > Is it better to have it in the normal mode too? yes, of course, not having it is a massive lack in functionality, having to search / investigate first is a massive lack in comfort, one can make normal round accessible for macros by 'wrapping it in a procedure call?': function round_a (ByVal darg1 as Double, iarg2 as integer) 'bs: 2020-10-27 'make "ROUND" functionality accessible from basic macros, 'out of duty as limited to 20 decimals, oFunctionAccess = createUnoService( "com.sun.star.sheet.FunctionAccess") round_a = oFunctionAccess.callFunction( "ROUND", array(darg1, iarg2)) end function 'round_a but better would be to have it as a normal basic function, and! one without flaws, afaik nearly all rounding in calc still has errors :-(
I've tested this today, and as of LO 7.6 the Round function is available without the need for Option Compatible or VBASupport. The code below runs fine in Basic: Sub TestRound Msgbox Round(1.536, 1) End Sub Tested with: Version: 7.6.4.1 (X86_64) / LibreOffice Community Build ID: 60(Build:1) CPU threads: 16; OS: Linux 6.5; UI render: default; VCL: kf5 (cairo+xcb) Locale: pt-BR (pt_BR.UTF-8); UI: en-US Ubuntu package version: 4:7.6.4-0ubuntu0.23.10.1 Calc: threaded I'm closing this as WFM. Feel free to reopen if necessary.