determine if cell is #N/A

G

Guest

I would like to find out if only a certain cell is #N/A due to faulty data
coming in. Will OnError allow me to prompt the user to input data for the
faulty cell? Or, can I just check for an error in the cell and call a
userform iwth the input?

Code:
For ediro = 4 To 199
With edi
If .Cells(ediro, 40).Type = xlerror Then
' Form_VacRate will accept input from the user to enter into .Cells(ediro,40)
With Form_VacRate
.TBempname = empname
.TBempname.Locked = True
.TBfilenum = empnum
.TBfilenum.Locked = True
.Show
End If
vacation = .Cells(ediro, 40).Value
End With
next ediro
 
C

Chip Pearson

Clay,

You can adapt the following code to suit your needs.

Dim R As Range
Dim V As Variant
Set R = Range("A1")
If IsError(R) = True Then
If R.Value = CVErr(xlErrNA) Then
Debug.Print "N/A ERROR"
Else
Debug.Print "OTHER ERROR"
End If
Else
Debug.Print "NO ERROR"
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 
G

Guest

Thank you.

I guess what I was looking for was the CVErr(xlErrNA).

I'll get rollin' on it!
--
Adios,
Clay Harryman


Chip Pearson said:
Clay,

You can adapt the following code to suit your needs.

Dim R As Range
Dim V As Variant
Set R = Range("A1")
If IsError(R) = True Then
If R.Value = CVErr(xlErrNA) Then
Debug.Print "N/A ERROR"
Else
Debug.Print "OTHER ERROR"
End If
Else
Debug.Print "NO ERROR"
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top