How to Highlight All Errors Using Macros (VBA) In Excel Office 365?
Tags: highlightallerrorsus, vbamacros
Published: 2021-02-19 11:12:53

---
title: How to Highlight All Errors Using Macros (VBA) In Excel Office 365?
published: true
date: 2021-02-19 08:38:49 UTC
tags: Highlightallerrorsus,VBAMacros
canonical_url: https://geekexcel.com/how-to-highlight-all-errors-using-macros-vba-in-excel-office-365/
---

If your worksheet has lots of error values, and you are tired of finding them? then continue reading this tutorial. Here, we come up with the easy steps to **highlight all errors using Macros ([VBA](https://geekexcel.com/excel-office-365-vba-overview-definition-and-examples/))** in **Excel Office**  **365**. Let’s see them one-by-one.
## Highlight All Errors using Macros:

To highlight all the errors in the worksheet, you need to follow the below steps.

- In this image, you can see the example data from the range **B1:B8** and there are some error values.
- We are going to find them using macros.

![Example data](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_7edOCADDow.png)<figcaption id="caption-attachment-22014">Example data</figcaption>

- On the **Developer Tab, select** the **Visual Basic** option under the **Code** section.

![Select Visual Basic option](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/09/Select-Visual-Basic-option-4.png)<figcaption id="caption-attachment-14755">Select the Visual Basic option</figcaption>

- Then you need to copy and paste the code given below.

VBA code to highlight errors using Macros

Sub HighlightAllErrors()

Dim cell As Range

For Each cell In ActiveSheet.UsedRange

If WorksheetFunction.IsError(cell) Then

cell.Style = “Bad”

End If

Next cell

End Sub

- You need to **save the code** by selecting it. Then **close** the **window.**

![Save the code](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_yzoCBiftk9.png)<figcaption id="caption-attachment-22015">Save the code</figcaption>

- You have to open the sheet containing the data. On the **Developer Tab, choose** the **Macros option** in the **Code** section.

![Choose the Macros option](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/09/Choose-the-Macros-option-2.png)<figcaption id="caption-attachment-14747">Choose the Macros option</figcaption>

- You need to make sure that your macro is selected and **click** the **Run** button.

![Click the Run button](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_z5wMSIVYGR.png)<figcaption id="caption-attachment-22016">Click the Run button</figcaption>

- Finally, you will get the result as shown in the below image.

![Output](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_0XMYNzGBVN.png)<figcaption id="caption-attachment-22017">Output</figcaption>

## Verdict:

In this tutorial, we guided you to know the step-by-step instructions to **highlight all errors using Macros ([VBA](https://geekexcel.com/excel-office-365-vba-overview-definition-and-examples/))** in **Excel Office**  **365**. Leave your **queries/suggestions** in the below comment section. Thanks for visiting **[Geek Excel.](https://geekexcel.com/)** Keep Learning!

### Keep Reading:

- [Highlight Cells with a Single Space using Macros (VBA) in Excel!!](https://geekexcel.com/highlight-cells-with-a-single-space-using-macros-vba-in-excel/)
- [Highlight Max Value in Selection using Macros (VBA) in Excel 365!!](https://geekexcel.com/highlight-max-value-in-selection-using-macros-vba-in-excel-365/)
- [Resize All Charts using Macros (VBA) in Excel Office 365!!](https://geekexcel.com/resize-all-charts-using-macros-vba-in-excel-office-365/)