OzGrid

Excel Errors & Alerts

< Back to Search results

 Category: [Excel]  Demo Available 

Excel Errors & Alerts

VBA ERRORS

Sub Stop_All_Errors()
On Error Resume Next
YOUR CODE
On Error GoTo 0 'Resets error trapping
End Sub

Sub Custom_Error_Message()
On Error GoTo MyCstmErr
YOUR CODE
Exit Sub
MyCstmErr: Msgbox "My Custom Error Message"
End Sub

Sub Stop_Warning_Alerts()
Application.DisplayAlerts=False
'Your code here! Example might be ActiveSheet.Delete
Application.DisplayAlerts=True
End Sub


FORMULA ERRORS

ISERR Function: For any error type except #N/A.
ISERROR Function: For any error type.
ISNA Function: For the #N/A error type.
Error.Type Function: For specifying error types. #NULL! = 1 #DIV/0! 2 #VALUE! 3 #REF! 4 #NAME? 5 #NUM! 6 #N/A 7

E.g =IF(ISERROR(VLOOKUP(Arguments)),0,VLOOKUP(Arguments))

 

See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets

 

See also:

Debug VBA Code
Debug, Evaluate/Audit & Fix Excel Formula Errors

 

 

Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.

 

Microsoft ® and Microsoft Excel ® are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft.


Gallery