excel vba公式中的字符串

时间:2022-03-18 22:18:23

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.

我有一个VBA代码,可以在一个单元格中插入下面的公式。我想将A7和字符串“EBF”组合成VLOOKUP公式中的一个字符串,但它似乎一直给我错误。

This is what I want in the excel cell:

这就是我想要的excel单元格:

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

= D7-IFERROR(VLOOKUP(A7&“CAF”,sheet1!A1:B31,2,FALSE),0)

This is my VBA Code to insert the formula into the cell:

这是我的VBA代码,用于将公式插入到单元格中:

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

2 个解决方案

#1


3  

Like (Remembering to use the .Formula to assign)

喜欢(记得使用.Formula分配)

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

#2


0  

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

#1


3  

Like (Remembering to use the .Formula to assign)

喜欢(记得使用.Formula分配)

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

#2


0  

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