Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在excelvba中绕过引号_Vba_Excel - Fatal编程技术网

在excelvba中绕过引号

在excelvba中绕过引号,vba,excel,Vba,Excel,我在VBA中使用了一个Excel公式。然而,当我编译它时,VBA抛出了一个错误 我有点确定这是因为我公式中的引号 Range("E2:E" & lastRow).FormulaLocal = "=IFERROR(IF(VLOOKUP(D2,$B:$B,1,FALSE)=D2,"Form Present"),"Not Present")" 这就是我试图解决的问题 Range("E2:E" & lastRow).FormulaLocal = "=IFERROR(IF(VLOOKU

我在VBA中使用了一个Excel公式。然而,当我编译它时,VBA抛出了一个错误

我有点确定这是因为我公式中的引号

Range("E2:E" & lastRow).FormulaLocal = "=IFERROR(IF(VLOOKUP(D2,$B:$B,1,FALSE)=D2,"Form Present"),"Not Present")"
这就是我试图解决的问题

 Range("E2:E" & lastRow).FormulaLocal = "=IFERROR(IF(VLOOKUP(D2,$B:$B,1,FALSE)=D2,&Chr(34)&Form Present&Chr(34)&),&Chr(34)&Not Present&Chr(34)&)"

我使用chr34在中生成报价符号,但这不起作用。有解决办法吗

只需将引号加倍,并将其更改为:

 Range("E2:E" & lastRow).FormulaLocal "=IFERROR(IF(VLOOKUP(D2,$B:$B,1,FALSE)=D2,""Form Present""),""Not Present"")"

如果1=1,Y,N失败,而如果1=1,Y,N成功,只需将引号加倍并将其更改为:

 Range("E2:E" & lastRow).FormulaLocal "=IFERROR(IF(VLOOKUP(D2,$B:$B,1,FALSE)=D2,""Form Present""),""Not Present"")"
这将失败=IF1=1,Y,N,而这将有效=IF1=1,Y,N

Range("E2:E" & lastRow).FormulaLocal = "=IFERROR(IF(VLOOKUP(D2,$B:$B,1,FALSE)=D2,""Form Present""),""Not Present"")"

任用

Range("E2:E" & lastRow).FormulaLocal = "=IFERROR(IF(VLOOKUP(D2,$B:$B,1,FALSE)=D2,""Form Present""),""Not Present"")"