I'm using Vlookup to lookup a "Product Type" in Column "D" vs a given "Product Code" that is listed in Column A. here is the code that I'm using,
this code works fine most of the time however every once in a while it skips. and that is the reason why i added an apostrophe in front of "On Error Resume Next" this way the code fails everytime Vlookup fails. every time it failed the product code and the product type existed in the right location but it still failed and the failure is very inconsistent, so what fails this time might not fail next time. I don't undertand why is it doing that or if there is a problem with the code. any help would be much appreciated.
Code:
'Product Type lookup
Set mg = Sheets("Product Code").Columns("A:D")
col = 4
'On Error Resume Next
ProductType = Application.VLookup(productcode, mg, col, 0)