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) 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.
- On the Developer Tab, select the Visual Basic option under the Code section.
- 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.
- You have to open the sheet containing the data. On the Developer Tab, choose the Macros option in the Code section.
- You need to make sure that your macro is selected and click the Run button.
- Finally, you will get the result as shown in the below image.
Verdict:
In this tutorial, we guided you to know the step-by-step instructions to highlight all errors using Macros (VBA) in Excel Office 365. Leave your queries/suggestions in the below comment section. Thanks for visiting Geek Excel. Keep Learning!
Top comments (0)