ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Identify product not found (https://www.excelbanter.com/excel-programming/318412-identify-product-not-found.html)

Pat

Identify product not found
 
Is there a way to identify what cell that does not have a product in so that
an error message can be acted upon. The following (part of) code is
returning "Product not found 0" when there does not appear to be a product
missing.

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

res = Application.Match(sProd, _
Worksheets("CC").Range("C31:C1000"), 0)
If Not IsError(res) Then
With Worksheets("CC")
If IsNumeric(Target.Value) Then
Set rng2 = .Cells(res + 30, icol)
rng2.Value = rng2.Value + Target.Value
End If
End With

Much appreciate it if you can be of help.
Pat



Pat

Identify product not found
 
I have found out where I have gone wrong.
Sorry folks.


"Pat" wrote in message
...
Is there a way to identify what cell that does not have a product in so

that
an error message can be acted upon. The following (part of) code is
returning "Product not found 0" when there does not appear to be a product
missing.

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

res = Application.Match(sProd, _
Worksheets("CC").Range("C31:C1000"), 0)
If Not IsError(res) Then
With Worksheets("CC")
If IsNumeric(Target.Value) Then
Set rng2 = .Cells(res + 30, icol)
rng2.Value = rng2.Value + Target.Value
End If
End With

Much appreciate it if you can be of help.
Pat






All times are GMT +1. The time now is 11:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com