# RepeatUntil

Repeats the execution of specified cells until either an exit condition becomes valid or the number of repetitions reaches the maximum number of iterations.

Note: When creating a repeating iteration of cells using the Repeat or RepeatUntil functions, if using a SetEvent function, it should be placed outside the cells being iterated. Placing the SetEvent function within the cells being iterated may cause the SetEvent to miss event triggers.

To use the RepeatUntil function:

1. Add the RepeatUntil function to a cell in Spreadsheet. The RepeatUntil function does not have a property sheet, and takes you directly into cell selection mode for the first parameter. You can also enter the parameters directly in the cell text box.

2. Specify the event that triggers the RepeatUntil function by selecting a cell in Spreadsheet that can be used as an Event.

3. Specify the exit condition that ends the RepeatUntil function by entering a non-zero value in the cell text box as the second argument of the function.

4. Specify the maximum number of iterations by entering a non-zero value in the cell text box as the third argument of the function.

   Note: The number of iterations specifies the number of repetitions after the initial execution. For example, if you set the number of iterations to 5, the selected cells execute 6 times including the first execution.

5. Specify the cell or cells that you want the RepeatUntil function to trigger by selecting a range of cells in Spreadsheet.

Inputs

Syntax: RepeatUntil(Event,Exit Condition,Max Iterations,Cells to Repeat)

Parameter | Description
--- | ---
Event | Specifies the event on which to read the specified Value. This parameter must be a reference to one of the following: The Image data structure in cell A1. A cell containing an Event function. A cell containing a Button function. A cell containing a numeric value, and if the numeric value changes, an event will be triggered.
Exit Condition | Specifies a non-zero value that defines the requirement to exit the repetitions.
Max Iterations | Specifies the maximum number of iterations (0 to 5000) that should be repeated.
Cells to Repeat | Specifies the reference to the cell or cells to be repeated. The reference must be a range of cells, a comma delimited list of cell references or a combination of the two.

Outputs

Returns | A Loop data structure containing data about the repetition of the cells.