ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to recognise "#N/A" (https://www.excelbanter.com/excel-programming/371650-how-recognise-n.html)

CH

How to recognise "#N/A"
 
I have a program and I saw some of the cells having "#N/A"

I wish to have excel delete its cell content if encounter this value.
eg. If activecell.value = "#N/A".

However, excel gave me a "type mismatch" error.

How can I overcome this?

Please help. Thanks.


Carim

How to recognise "#N/A"
 
Hi,

With following test ...
=IF(ISNA(A1),"",A1)

HTH
Cheers
Carim


Ron Rosenfeld

How to recognise "#N/A"
 
On Tue, 29 Aug 2006 00:18:01 -0700, ch wrote:

I have a program and I saw some of the cells having "#N/A"

I wish to have excel delete its cell content if encounter this value.
eg. If activecell.value = "#N/A".

However, excel gave me a "type mismatch" error.

How can I overcome this?

Please help. Thanks.


Try this:

======================
Option Explicit
Sub clearNA()
Dim c As Range
Set c = [a1]

If IsError(c.Value) Then
If c.Value = CVErr(xlErrNA) Then
c.ClearContents
End If
End If

End Sub
=========================
--ron


All times are GMT +1. The time now is 01:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com