RETURN

Macro Sheets Only

Ends the currently running macro. If the currently running macro is a subroutine macro that was called by another macro, control is returned to the calling macro. If the currently running macro is a custom function, control is returned to the formula that called the custom function. If the currently running macro is a command macro started by the user with the Run button in the Macro dialog box or a shortcut key or by clicking an object, control is returned to the user.

Syntax

RETURN(value)

Value specifies what to return.

Remarks

RETURN signals the end of a macro. Every macro must end with a RETURN or HALT function, but not every macro returns values.

Example

The following function returns the sum of the range B1:B10:


RETURN(SUM(B1:B10))

Related Functions

BREAK Interrupts a FOR-NEXT, FOR.CELL-NEXT, or WHILE-NEXT loop

HALT Stops all macros from running

RESULT Specifies the data type a custom function returns

List of Control Functions