Hello! I have written a code that checks a value in one column (Column "C") and does a vlookup for corresponding values to put in other columns (Columns "AH" to "AM").
Using a For Next loop it does this until it has checked all the rows from the 3rd row to the last row with data in it.
Within the loop I have several If statements: first to check the "C" column value that I'm using to do the lookup with meets certain criteria (i.e. the cell isn't empty, and doesn't say "Product ID").
All of my code worked fine until I added a second set of criteria based on the destination cell. I don't want the code to update cells that already have a value in them, unless the value is #N/A (i.e. Error 2042).
Here is the code:
It seems like VBA has no problem executing code like line 7:![]()
Please Login or Register to view this content.
But as soon as the cell to check is the target cell and not the lookup value, it gives a Type mismatch error:![]()
Please Login or Register to view this content.
The code also breaks at line 18:![]()
Please Login or Register to view this content.
Maybe that's not the problem, but that's the only thing I can see different between those very similar lines of code.![]()
Please Login or Register to view this content.
Any solutions![]()
Bookmarks