I don’t know why the macro I recorded is giving error! I added the “Do … Loop Until” command to the end of the macro.
The macro’s function is to stop the sum in cell A7 when the result equals 0 (zero).
Below is an attached template sheet.
In A1: A6
= INT (RAND () * 2)
In A7
= SUM (A1: A6)
Sub Main
dim document as object
dim dispatcher as object
dim args1(0) as new com.sun.star.beans.PropertyValue
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
args1(0).Name = "ToPoint"
args1(0).Value = "$Sheet1.$A$7"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
Do
ThisComponent.calculateAll()
Loop Until args1(0).Value = 0
End Sub
Grateful for the attention!
Orlando Souza