Hi everyone. This is driving me bananas. Basically, my macro is supposed to enter a formula and copy it down.
The formula will lookup cell A2 (a part number) from the Parts Prices sheet and return the price, but if there is an error, then lookup the first 8 digits of cell A2 from the Updated Parts Prices sheet.![]()
Sub Parts_Usage() With Sheets("Parts Usage") .Range("C2:C" & .Cells(.Rows.Count, "A").End(xlUp).Row).Formula = "=IFERROR(VLOOKUP(A2,'Parts Prices'!$A:$H,8,FALSE),VLOOKUP(" * "&LEFT(A2,8)&" * ",'Updated Parts Prices'!$A$11:$Q$236,13,FALSE))" End With End Sub
The formula works fine on its own but when I enter it as VBA I get a runtime error 13 Type Mismatch. I would really appreciate any help on this. I have attached a workbook.
Bookmarks