Modifying Error Alerts Received

Written by Allen Wyatt (last updated October 14, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


2

Excel has an alert feature for possible errors in a cell. This alert shows as a green triangle in the top-left corner of a cell. This is helpful in some instances but a real bother in others. For example, Peter has a list of addresses in a worksheet. In one column he has the ZIP Codes formatted as text. Excel constantly tells him that all the cells in this column are numbers formatted as text, a fact that (in his case) is intentional. Peter wonders if there is a way to suppress that particular alert for just that column. He tried selecting the column and clicking "Ignore error," but that only works temporarily. If he edits a cell the alert returns, and if he closes and reopens the workbook the alert returns.

Excel allows you to adjust which errors it flags and which it ignores. You can do so by following these steps:

  1. Display the Excel Options dialog box. (In Excel 2007 click the Office button and then click Excel Options. In Excel 2010 and later versions display the File tab of the ribbon and then click Options.)
  2. At the left side of the dialog box, click Formulas. (See Figure 1.)
  3. Figure 1. The Formulas settings in the Excel Options dialog box.

  4. Near the bottom of the dialog box, clear the Numbers Formatted As Text or Preceded by an Apostrophe check box.
  5. Click OK.

Now, Excel will not mark these types of potential errors as you are using the program. If you wanted to, you could handle this process by using a macro. This would allow you to turn this error checking off while using the worksheet, but back on if you go to another worksheet. You would do this by using the Worksheet_Activate and Worksheet_Deactivate event handlers, in this manner:

Private Sub Worksheet_Activate()
    Application.ErrorCheckingOptions.NumberAsText = False
End Sub
Private Sub Worksheet_Deactivate()
    Application.ErrorCheckingOptions.NumberAsText = True
End Sub

You can get to the code window where these event handlers are entered by right-clicking on the worksheet tab and choosing the Code option from the resulting Context menu.

Of course, Peter asked that the errors only be suppressed on the single column. This gets a bit trickier, but can still be done. Unfortunately, VBA only allows you to set the error checking options on a cell-by-cell basis, which means that it becomes unworkable to change the setting for the entire column. If you wanted to do it for a range of cells in a particular column, you could do it in this manner:

Private Sub Workbook_Open()
    Dim c As Range

    For Each c In Worksheets("Retail Figures").Range("A1:A100")
        c.Errors(xlNumberAsText).Ignore = True
    Next
End Sub

Note that this is the Workbook_Open event handler, which is placed in the code window for the ThisWorkbook object. It runs when the workbook is opened, and it sets the error checking for the A1:A100 range on the Retail Figures worksheet. You'll obviously want to change the range to reference the cells you want to affect.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (5229) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Undoing an AutoFormat

Excel allows you to automatically format data tables using a number of different schemes. What happens if you want to ...

Discover More

Colorizing Charts

Need to change the color of different parts of your chart? It's easy to do when you apply the technique described in this ...

Discover More

Deleting VBA Code in a Copied Worksheet

VBA makes it easy to copy a worksheet from the current workbook into a brand-new workbook. You may want to delete some ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Removing Add-ins

Add-ins are used to extend Excel's capabilities in lots of different ways. If you want to get rid of an add-in ...

Discover More

Iterating Circular References

Does your data require that you perform calculations using circular references? If so, then you'll want to be aware of ...

Discover More

Seeing Excel's Program Window

Have you ever opened Excel to find that the window you saw yesterday is not the same as it is today? Sometimes, for ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 0?

2023-10-18 15:31:22

J. Woolley

Re. formula error checking, the Tip says, "This is helpful in some instances but a real bother in others." In my humble opinion it is best to uncheck the option labeled "Enable background error checking" and avoid the bother.
My Excel Toolbox's ToggleFormulaErrorChecking macro (Ctrl+T F E) will toggle that option (Enable/Disable). The macro supports Undo (Ctrl+Z). Here is an abbreviated version:

Sub ToggleFormulaErrorChecking()
Const myName As String = "ToggleFormulaErrorChecking"
With Application.ErrorCheckingOptions
.BackgroundChecking = (Not .BackgroundChecking)
End With
Application.OnUndo myName, (ThisWorkbook.Name + "!" + myName)
End Sub

See https://sites.google.com/view/MyExcelToolbox


2023-10-17 12:04:36

J. Woolley

My Excel Toolbox includes the following array function to report the status of error checking options:
=ListErrorCheckingOptions()
Expect 2 columns and 13 rows. When using pre-2021 versions of Excel without support for dynamic arrays, review UseSpillArray.pdf.
See https://sites.google.com/view/MyExcelToolbox


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.