Ed
Everytime you have a double quote inside your string, change it to two
double quotes.
="This ""text"" in quotes"
="This " & Chr(34) & "text" & Chr(34) & " in quotes"
both produce
This "text" in quotes
--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.
"Ed" wrote in message
...
I'm trying to write a formula into a cell using VBA. The
formula has quotes in it and this is causing me
problems. Can anyone convert the below 'formula' into
VBA code so that it will work?
activecell.formulaArray =
"SUM(IF('Data from Prc Qry'!$G$2:$G$15000=J$1,IF('Data
from Prc Qry'!$E$2:$E$15000=$A2,'Data from Prc Qry'!
$K$2:$K$15000,0),0))/COUNTIF('Data from Prc Qry'!
$A$2:$A$15000,$A2&" "&TEXT(J$1,"mm/dd/yyyy"))"
You might notice that this is an array formula - will
this use of double quotes still work as such?