PDA

View Full Version : excel formula in vba



tommy1234
04-06-2010, 01:04 AM
Hello
I can't find solution for the using of this formula with vba
the formula is :
range("b1").Formula= "=IF(OR(U73>=5,AND(AA73>0,AA73<>""))=TRUE,IF(BB73>=1000,"A","B"),IF(OR(U73<5,OR(AA73=0,AA73=""))=TRUE,IF(BB73>1000,"C","E"),"D"))"
How can i write it without getting error on each inverted commas ?

Thanks

Bob Phillips
04-06-2010, 01:10 AM
Double them up



Range("B1").Formula= "=IF(OR(U73>=5,AND(AA73>0,AA73<>""""))=TRUE,IF(BB73>=1000,""A"",""B"")," & _
"IF(OR(U73< 5,OR(AA73=0,AA73=""""))=TRUE,IF(BB73>1000,""C"",""E""),""D""))"

Bob Phillips
04-06-2010, 01:13 AM
The TRUEs are redundant as well




Range("B1").Formula= "=IF(OR(U73>=5,AND(AA73>0,AA73<>"""")),IF(BB73>=1000,""A"",""B"")," & _
"IF(OR(U73< 5,OR(AA73=0,AA73="""")),IF(BB73>1000,""C"",""E""),""D""))"