Excel: Suppressing Error Alerts in Macro or Branching at Error

Last reviewed: October 31, 1994
Article ID: Q31691

SUMMARY

To temporarily turn error checking off during a macro, use the function =ERROR(FALSE).

To run a different macro if an error occurs, use the function =ERROR(TRUE,ref), where ref is the reference of the macro to run should an error occur.

For example, when using DATA.FIND(TRUE) in a macro, to prevent the "No Match" alert when no database records match the criteria on the worksheet, use the following macro steps

   =ERROR(TRUE,ref)
   =DATA.FIND(TRUE)

where ref is the location to go to when DATA.FIND(TRUE) does not find any records.

This procedure can be can be used with other functions, such as FORMULA.FIND() and OPEN().


KBCategory: kbother
KBSubcategory:

Additional reference words: 1.00 1.03 1.04 1.06 1.50 2.20 3.00


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 31, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.