Find 'Product not found'

P

Pat

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
 
G

Guest

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
 
G

Guest

Sorry I was not looking close enough at your code...
Just put my message box immediately after your "Product not Found" Message...

sorry... I thought your code was throwing a run time error not your error
message...
 

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