简体   繁体   中英

String inside an excel vba formula

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)"

点赞(记住要使用.Formula进行分配)

Range("H7").Formula = "=D7-IFERROR(VLOOKUP(A7 & ""CAF"" ,sheet1!A2:B31,2,FALSE),0)"

"=D7-IFERROR(VLOOKUP(A7&""EBF"",sheet1!A2:B31,2,FALSE),0)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM