View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_3_] Jim Thomlinson[_3_] is offline
external usenet poster
 
Posts: 983
Default Find 'Product not found'

Try something like this

On Error Goto Tada

Your code Here...

end sub
Tada:
msgbox target.address & " Caused an Error"
resume next
end sub
Exit sub


HTH

"Pat" wrote:

Is there a way to find a cell(s) that causes an error when code is run. The
following code returns 'Product not found: 0' error. I have looked up and
down but cannot find the offending 3 cells.


For Each Target In rng1
sProd = Target.Parent.Cells(Target.Row, 18)

res = Application.Match(sProd, _
Worksheets("ControlCentre").Range("C77:C1000"), 0)
If Not IsError(res) Then
With Worksheets("ControlCentre")
' Will return quantity 'Back into stock'
If IsNumeric(Target.Value) Then
Set rng2 = .Cells(res + 76, icol)
rng2.Value = rng2.Value + Target.Value
End If
End With
Else
MsgBox "Product Not found: " & sProd
End If
Next