VBA Code for "" empty cell

  • Thread starter Thread starter ManhattanRebel
  • Start date Start date
M

ManhattanRebel

The following IF function works in Excel, but when I copy it into VBA so I
can excute it in a range it will not work.

Range("p6:p40").Formula = "=IF(C6="","",(P5+O6)-M6)"

I think VBA has a problem with "" meaning an empty cell.

Can someone tell me what I can substitute for "" so my formula will work in
VBA?
 
Try the below.. VBA recognizes double double quote as a single double quote

Range("p6:p40").Formula = "=IF(C6="""","""",(P5+O6)-M6)"

If this post helps click Yes
 
Thank you...that solved the problem

Jacob Skaria said:
Try the below.. VBA recognizes double double quote as a single double quote

Range("p6:p40").Formula = "=IF(C6="""","""",(P5+O6)-M6)"

If this post helps click Yes
 
Back
Top