vba添加空格以优于单元格

时间:2015-06-08 15:54:05

标签: vba excel-vba excel

您好我尝试使用vba在excel公式中添加空格我的代码是:

.Cells(row, col).Value = "=if(A1=0," & " " & ",'S1'!$D$1)"

此代码在excel这个公式中添加到我的单元格

=if(A1=0, ,'S1'!$D$1)

但我想要这样的东西

"=if(A1=0," ",'S1'!$D$1)"

这可以在vba中做到吗?

1 个答案:

答案 0 :(得分:0)

.Cells(row, col).Value = "=if(A1=0,"" "",'S1'!$D$1)"