unknownymous

Board Regular
Joined
Sep 19, 2017
Messages
249
Office Version
  1. 2016
Platform
  1. Windows
Hello Gurus,

How can you delete/clear those cells that contains #VALUE! (note that it contains formula).

So far I saw this code:
= = = =

Delete cell only
If IsError(Range("C7")) Then Range("C7").Delete

= = = =
I have 10-15 tabs sheets and I need to run the macro like scan cells that contains #VALUE! (no specific column/rows) and clear contents for specific sheets let's say Sheet 1, 3 & 5.

Appreciate the help.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
#VALUE is Excel's way of saying, "There's something wrong with the way your formula is typed. Or, there's something wrong with the cells you are referencing."

The formula is, hopefully, there for a good reason.

You really need to get to the bottom of what the real problem is.

It may then point you to other, less obvious, things that are going wrong.
 
Upvote 0
VBA Code:
Option Explicit

Sub delerror()
    Dim ws As Worksheet
    Dim c As Range
    Dim rng As Range
    For Each ws In ThisWorkbook.Worksheets
        Set rng = ws.Range("A1").CurrentRegion
        For Each c In rng
            If IsError(c) Then c.ClearContents
        Next c
    Next ws
    MsgBox "Action completed"
End Sub
 
Upvote 0
#VALUE is Excel's way of saying, "There's something wrong with the way your formula is typed. Or, there's something wrong with the cells you are referencing."

The formula is, hopefully, there for a good reason.

You really need to get to the bottom of what the real problem is.

It may then point you to other, less obvious, things that are going wrong.
For some reason I am getting an error value.

Column S8 - my formula is =$R8-$U8
Column T8 - my formula is =$R8-$T8

Probably, I should fix the formula like it there's an error wherein there's no data, it should be left as blank cell.
 

Attachments

  • Value Error.PNG
    Value Error.PNG
    5.1 KB · Views: 5
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,956
Members
449,096
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top