HALT macro

Stops all macros from running. Use HALT instead of RETURN to prevent a macro from returning to the macro that called it.

Syntax

HALT(cancel_close)

Cancel_close    is a logical value that specifies whether a macro sheet, when encountering the HALT function in an Auto_Close macro, is closed.

 

Remarks

You can prevent an Auto_Close or Auto_Open macro from running by holding down the SHIFT key while opening or closing the workbook.

Examples

If A1 contains the #N/A error value, then when the following macro formula is calculated, the macro halts:

IF(ISERROR(A1), HALT(), GOTO(D4))

The following macro formula at the end of an Auto_Close macro ends the macro and prevents the workbook from being closed:

HALT(TRUE)

Related Functions

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

RETURN   Ends the currently running macro

Return to index