ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Quotes in formula (https://www.excelbanter.com/excel-programming/284136-quotes-formula.html)

Kevin

Quotes in formula
 
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


Thank you!
Kevin

J.E. McGimpsey

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



All times are GMT +1. The time now is 11:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com