Reputation: 15
I have a VBA code that insert the formula below in a cell. I want to combine A7 and string "EBF" into one string inside the VLOOKUP formula but it seems to keep giving me error.
This is what I want in the excel cell:
=D7-IFERROR (VLOOKUP (A7&"CAF",sheet1!A1:B31,2,FALSE),0)
This is my VBA Code to insert the formula into the cell:
Range("H7") = "=D7-IFERROR(VLOOKUP(A7 & ""EBF"" & ",sheet1!A2:B31,2,FALSE),0)"
Upvotes: 0
Views: 2662
Reputation: 84465
Like (Remembering to use the .Formula to assign)
Range("H7").Formula = "=D7-IFERROR(VLOOKUP(A7 & ""CAF"" ,sheet1!A2:B31,2,FALSE),0)"
Upvotes: 4