View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
J.E. McGimpsey J.E. McGimpsey is offline
external usenet poster
 
Posts: 493
Default Quotes in formula

Quotes in VBA, like in XL strings, must be doubled:

ActiveCell.Formula = _
"=(100*(RELATIVE(""sp50.R"",1+P_TOTAL_RETURNC( " & _
DateToUse & ",0)/100)-1))+100"


In article ,
"Kevin" wrote:

I am trying to put a formula into excel using the
following VBA code. I am having problems getting the
quotes around "sp50.R". Quotes need to show up in Excel,
but I'm not sure how to make them appear.

DateToUse = ActiveCell.Offset(0, -4).Value
ActiveCell.Formula = "^=(100*(RELATIVE
("sp50.R",1+P_TOTAL_RETURNC(" & DateToUse & ",0)/100)-1))
+100"
ActiveCell.Offset(1, 0).Select