Reputation:
I have been trying to remove 0
and #N/A"
from the cell but when i run the code it gives me an error Type Mismatch.
Can someone please look into the issue that why an error is occur. Your help will be appreciated.
If sht3.Range("B4") = 0 Or "#N/A" Then
sht3.Range("B4") = ""
End If
Upvotes: 0
Views: 74
Reputation: 50143
The error #N/A
is not text. Attempting to compare an error value to a number or text is an automatic type mismatch.
You can use Application.IsNA
, but note that you need to move the check for 0 into an ElseIf
(this assumes the cell cannot be any other type of error, e.g. #DIV/0
).
With sht3.Range("B4")
If Application.IsNA(.Value) Then
.Value = ""
ElseIf .Value = 0
.Value = ""
End If
End With
Upvotes: 1