If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
VBA Code for "" empty cell
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("p640").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? |
#2
|
|||
|
|||
VBA Code for "" empty cell
Try the below.. VBA recognizes double double quote as a single double quote
Range("p640").Formula = "=IF(C6="""","""",(P5+O6)-M6)" If this post helps click Yes --------------- Jacob Skaria "ManhattanRebel" wrote: 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("p640").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? |
#3
|
|||
|
|||
VBA Code for "" empty cell
Thank you...that solved the problem
"Jacob Skaria" wrote: Try the below.. VBA recognizes double double quote as a single double quote Range("p640").Formula = "=IF(C6="""","""",(P5+O6)-M6)" If this post helps click Yes --------------- Jacob Skaria "ManhattanRebel" wrote: 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("p640").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? |
Thread Tools | |
Display Modes | |
|
|