View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Detect #N/A or number

Hi Peter,

Not sure if I understand your question properly or if ryguy has provided the
answer you are looking for because I get the feeling you are looking for a
VBA answer. However, thought I would post the following example to see if it
helps.

Note that a space and underscore at the end of a line is a line break in an
otherwise single line of code.

Dim i As Long

For i = 1 To 10
If IsNumeric(Cells(i, 2)) Then
MsgBox "Cell " & Cells(i, 2) _
.Address & "= " & Cells(i, 2).Value
Else
If WorksheetFunction.IsNA(Cells(i, 2)) Then
MsgBox "Cell " & Cells(i, 2) _
.Address & "= #N/A"
Else
MsgBox "Cell " & Cells(i, 2) _
.Address & " Not Numeric or #N/A"
End If
End If
Next i


--
Regards,

OssieMac