Thread: Loop Problem
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Loop Problem

Excel returns the Error (xlErrNA, or 2042) in the Value property if the
formula returns #N/A.

You could use:

If cell1.Text = "#N/A" Then

instead.


Todd - you've been posting here long enough to know that you should
include the error message that you get, rather than just saying "an
error".

In article ,
"Todd Huttenstine" wrote:

Dim rng As Range
Dim cell1 As Object
Set rng = Sheets("Converted Data").Range("O2:O100")
For Each cell1 In rng
If cell1 = "#N/A" Then
Sheets("Mismatches").Range("A:" & Sheets
("Mismatches").Range("H2").Value) = cell1
Else
End If
Next

I keep getting an error with the above code. It is not
seeing the #N/A error correctly. There are formulas all
in range O2:O100. How would I make this work?