Excel Vba: Double quotes in formula?

后端 未结 3 1529
误落风尘
误落风尘 2021-01-26 23:14

I don\'t know the syntax for handling double quotation marks within a formula.

Here is my code:

ActiveCell.Formula = \"=IF($W9=\"A\",1,IF($W9=\"B\",2, I         


        
3条回答
  •  粉色の甜心
    2021-01-27 00:05

    You need to change the formula to

    ActiveCell.Formula = "=IF($W9=""A"",1,IF($W9=""B"",2, IF($W9=""C"",3,0)))"
    

    So, first you need to double quote and in your case you also need to count the number of "(" and ")"

提交回复
热议问题