QUIT

Macro Sheets Only

Equivalent to choosing the Exit command from the File menu in Microsoft Excel for Windows. Equivalent to choosing the Quit command from the File menu in Microsoft Excel for the Macintosh. Quits Microsoft Excel and closes any open documents. If open documents have unsaved changes, Microsoft Excel displays a message asking if you want to save them. You can use QUIT in an Auto_Close macro to force Microsoft Excel to quit when a particular worksheet or macro sheet is closed.

Syntax

QUIT( )

Caution If you have cleared error-checking with an ERROR(FALSE) function, QUIT will not ask whether you want to save changes.

Remarks

When you use the QUIT function, Microsoft Excel does not run any Auto_Close macros before closing the document.

Examples

The following function displays a confirmation alert and quits Microsoft Excel if the user chooses OK:


IF(ALERT("Are you sure you want to quit Microsoft Excel?",1), QUIT(),)

Related Function

FILE.CLOSE Closes the active document

List of Command-Equivalent Functions